org.wildfly.common.Assert类的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(286)

本文整理了Java中org.wildfly.common.Assert类的一些代码示例,展示了Assert类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert类的具体详情如下:
包路径:org.wildfly.common.Assert
类名称:Assert

Assert介绍

[英]A set of assertions and checks.
[中]一组断言和检查。

代码示例

代码示例来源:origin: wildfly/wildfly

/**
 * Construct a new instance.
 *
 * @param prompt the password reset prompt (must not be {@code null} or empty)
 */
public PasswordResetCallback(final String prompt) {
  Assert.checkNotNullParam("prompt", prompt);
  Assert.checkNotEmptyParam("prompt", prompt);
  this.prompt = prompt;
}

代码示例来源:origin: wildfly/wildfly

public MessageTracker(final Channel channel, final int limit) {
  Assert.checkNotNullParam("channel", channel);
  Assert.checkMinimumParameter("limit", 1, limit);
  this.channel = channel;
  counter = limit;
}

代码示例来源:origin: wildfly/wildfly

private String passwordAlgorithm(final String mechanismName) {
  switch (mechanismName) {
    case SaslMechanismInformation.Names.DIGEST_SHA:     return DigestPassword.ALGORITHM_DIGEST_SHA;
    case SaslMechanismInformation.Names.DIGEST_SHA_256: return DigestPassword.ALGORITHM_DIGEST_SHA_256;
    case SaslMechanismInformation.Names.DIGEST_SHA_384: return DigestPassword.ALGORITHM_DIGEST_SHA_384;
    case SaslMechanismInformation.Names.DIGEST_SHA_512: return DigestPassword.ALGORITHM_DIGEST_SHA_512;
    case SaslMechanismInformation.Names.DIGEST_SHA_512_256: return DigestPassword.ALGORITHM_DIGEST_SHA_512_256;
    case SaslMechanismInformation.Names.DIGEST_MD5:     return DigestPassword.ALGORITHM_DIGEST_MD5;
    default: throw Assert.impossibleSwitchCase(mechanismName);
  }
}

代码示例来源:origin: wildfly/wildfly

/**
 * Set the maximum queue size.
 *
 * @param maxQueueSize the maximum queue size (must be ≥ 0)
 * @see EnhancedQueueExecutor#setMaximumQueueSize(int)
 */
public Builder setMaximumQueueSize(final int maxQueueSize) {
  Assert.checkMinimumParameter("maxQueueSize", 0, maxQueueSize);
  Assert.checkMaximumParameter("maxQueueSize", Integer.MAX_VALUE, maxQueueSize);
  this.maxQueueSize = maxQueueSize;
  return this;
}

代码示例来源:origin: wildfly/wildfly

AbstractEJBMetaData(final Class<T> remoteInterfaceClass, final EJBHomeLocator<H> homeLocator) {
  Assert.checkNotNullParam("remoteInterfaceClass", remoteInterfaceClass);
  Assert.checkNotNullParam("homeLocator", homeLocator);
  this.remoteInterfaceClass = remoteInterfaceClass;
  this.homeLocator = homeLocator;
}

代码示例来源:origin: wildfly/wildfly

SecurityIdentity transform(final SecurityIdentity securityIdentity) {
  Assert.checkNotNullParam("securityIdentity", securityIdentity);
  return Assert.assertNotNull(securityIdentityTransformer.apply(securityIdentity));
}

代码示例来源:origin: wildfly/wildfly

Assert.checkNotNullParam("type", type);
if (value == null) return getNullReference();
switch (type) {
    return getNullReference();
  default:
    throw Assert.impossibleSwitchCase(type);

代码示例来源:origin: wildfly/wildfly

RemoteTransactionContext(List<RemoteTransactionProvider> providers, boolean clone) {
  Assert.checkNotNullParam("providers", providers);
  if (clone) {
    providers = Arrays.asList(providers.toArray(NO_PROVIDERS));
  }
  Assert.checkNotEmptyParam("providers", providers);
  final int size = providers.size();
  for (int i = 0; i < size; i++) {
    Assert.checkNotNullArrayParam("providers", i, providers.get(i));
  }
  this.providers = providers;
}

代码示例来源:origin: wildfly/wildfly

private EJBMethodLocator(final String methodName, final String[] parameterTypeNames, boolean copy) {
  Assert.checkNotNullParam("methodName", methodName);
  Assert.checkNotNullParam("parameterTypeNames", parameterTypeNames);
  this.methodName = methodName;
  final int length = parameterTypeNames.length;
  String[] clone = this.parameterTypeNames = copy && length > 0 ? parameterTypeNames.clone() : parameterTypeNames;
  for (int i = 0; i < length; i++) {
    Assert.checkNotNullArrayParam("parameterTypeNames", i, clone[i]);
  }
  hashCode = calcHashCode(methodName, parameterTypeNames);
}

代码示例来源:origin: wildfly/wildfly

void lock(Object key) {
  Assert.assertNotNull(key);
  if (! lockRef.compareAndSet(null, key)) {
    throw new SecurityException("Selector is locked");
  }
}

代码示例来源:origin: wildfly/wildfly

public ConnectionBuilder setHeartbeatInterval(final int heartbeatInterval) {
  Assert.checkMinimumParameter("heartbeatInterval", 1, heartbeatInterval);
  this.heartbeatInterval = heartbeatInterval;
  return this;
}

代码示例来源:origin: wildfly/wildfly

/**
 * Not supported.
 *
 * @return nothing
 * @throws UnsupportedOperationException always
 */
public String readLine() throws UnsupportedOperationException {
  throw Assert.unsupported();
}

代码示例来源:origin: wildfly/wildfly

public LdapSecurityRealmBuilder build() {
  assertNotBuilt();
  Assert.checkNotEmptyParam("certificateVerifiers", certificateVerifiers);
  built = true;
  addEvidenceVerifier(new X509EvidenceVerifier(certificateVerifiers));
  return LdapSecurityRealmBuilder.this;
}

代码示例来源:origin: wildfly/wildfly

ContextPermission(final String name, final int actionBits) {
  super(name);
  Assert.checkNotNullParam("name", name);
  this.actionBits = actionBits & ACTION_ALL;
}

代码示例来源:origin: wildfly/wildfly

/**
   * Get or compute the value for the given key, storing the computed value (if one is generated).  The function
   * must not generate a {@code null} value or an unspecified exception will result.
   *
   * @param sslSession the SSL session (must not be {@code null})
   * @param key the key to retrieve (must not be {@code null})
   * @param mappingFunction the function to apply to acquire the value (must not be {@code null})
   * @return the stored or new value (not {@code null})
   */
  public static <R> R computeIfAbsent(SSLSession sslSession, String key, Function<String, R> mappingFunction) {
    Assert.checkNotNullParam("sslSession", sslSession);
    Assert.checkNotNullParam("key", key);
    Assert.checkNotNullParam("mappingFunction", mappingFunction);
    synchronized (sslSession) {
      final R existing = (R) sslSession.getValue(key);
      if (existing == null) {
        R newValue = mappingFunction.apply(key);
        Assert.assertNotNull(newValue);
        sslSession.putValue(key, newValue);
        return newValue;
      } else {
        return existing;
      }
    }
  }
}

代码示例来源:origin: wildfly/wildfly

Assert.checkNotNullParam("type", type);
if (value == null) return getNullReference();
switch (type) {
    return getNullReference();
  default:
    throw Assert.impossibleSwitchCase(type);

代码示例来源:origin: wildfly/wildfly

void unlock(Object key) {
    Assert.assertNotNull(key);
    if (! lockRef.compareAndSet(key, null)) {
      throw new SecurityException("Selector could not be unlocked");
    }
  }
}

代码示例来源:origin: wildfly/wildfly

/**
 * Set the stale transaction time, in seconds.  The time must be no less than one second.
 *
 * @param staleTransactionTime the stale transaction time, in seconds
 */
public Builder setStaleTransactionTime(final int staleTransactionTime) {
  Assert.checkMinimumParameter("staleTransactionTime", 1, staleTransactionTime);
  this.staleTransactionTime = staleTransactionTime;
  return this;
}

代码示例来源:origin: wildfly/wildfly

/**
 * Unsupported.
 */
public void remove() {
  throw Assert.unsupported();
}

代码示例来源:origin: wildfly/wildfly

/**
 * Get an item from this mapping by ID.
 *
 * @param index the index to look up
 * @return the mapped item for the given ID
 * @throws IllegalArgumentException if the given index is out of range
 */
public T getItemById(int index) throws IllegalArgumentException {
  Assert.checkMinimumParameter("index", 0, index);
  Assert.checkMaximumParameter("index", stringEnumeration.size() - 1, index);
  return items[index];
}

相关文章