org.wildfly.common.Assert.checkNotNullArrayParam()方法的使用及代码示例

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

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

Assert.checkNotNullArrayParam介绍

[英]Check that a value within the named array parameter is not null. Use a standard exception message if it is.
[中]检查命名数组参数中的值是否不为null。如果是,请使用标准异常消息。

代码示例

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

MultiPredicate(final SaslMechanismPredicate[] predicates) {
  for (int i = 0; i < predicates.length; i++) {
    SaslMechanismPredicate predicate = predicates[i];
    Assert.checkNotNullArrayParam("predicates", i, predicate);
  }
  this.predicates = predicates;
}

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

private CompositePrincipal(Principal[] principals, boolean clone) {
  p = principals.length == 0 ? NO_PRINCIPALS : clone ? principals.clone() : principals;
  for (int i = 0; i < p.length; i++) {
    Assert.checkNotNullArrayParam("principals", i, p[i]);
  }
}

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

/**
 * Set the realm names.  None of the realm names may be {@code null}.  The array is not copied, so care must
 * be taken to avoid modifying the realm array after it is set.
 *
 * @param realmNames the realm names (may not be {@code null}, may not contain {@code null})
 */
public void setRealmNames(final String... realmNames) {
  Assert.checkNotNullParam("realmNames", realmNames);
  for (int i = 0, realmNamesLength = realmNames.length; i < realmNamesLength; i++) {
    Assert.checkNotNullArrayParam("realmNames", i, realmNames[i]);
  }
  this.realmNames = realmNames;
}

代码示例来源: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

/**
 * Construct a new instance.  The given values are used as the string members in the order they are given.
 *
 * @param values the values
 * @return the string enumeration
 */
public static StringEnumeration of(String... values) {
  final int length = values.length;
  Data[] byId = new Data[length];
  HashMap<String, Data> index = new HashMap<>(length);
  String str;
  for (int i = 0; i < length; i ++) {
    str = Assert.checkNotNullArrayParam("values", i, values[i]);
    index.put(str, byId[i] = new Data(i, str));
  }
  return new StringEnumeration(index, byId);
}

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

/**
   * Register a group of service URLs to be controlled with a single handle.  Any valid service URL may be provided,
   * and the registrations will last until the handle is closed.  If the service URL is not supported, the
   * {@linkplain ServiceRegistration#EMPTY empty registration handle} is returned.
   *
   * @param serviceURLs the services to register (must not be {@code null} or contain {@code null} elements)
   * @return the registration handle (not {@code null})
   */
  public ServiceRegistration registerServices(ServiceURL... serviceURLs) {
    Assert.checkNotNullParam("serviceURLs", serviceURLs);
    final int length = serviceURLs.length;
    for (int i = 0; i < length; i++) {
      Assert.checkNotNullArrayParam("serviceURLs", i, serviceURLs[i]);
    }
    return registryProvider.registerServices(serviceURLs);
  }
}

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

AbstractX509CertificateChainCredential(X509Certificate... certificateChain) {
  Assert.checkNotNullParam("certificateChain", certificateChain);
  if (certificateChain.length > 0) {
    this.certificateChain = certificateChain.clone();
    final int length = this.certificateChain.length;
    for (int i = 0; i < length; i++) {
      Assert.checkNotNullArrayParam("certificateChain", i, this.certificateChain[i]);
    }
  } else {
    throw ElytronMessages.log.certificateChainIsEmpty();
  }
}

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

private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
  ois.defaultReadObject();
  Assert.checkNotNullParam("methodName", methodName);
  Assert.checkNotNullParam("parameterTypeNames", parameterTypeNames);
  for (int i = 0; i < parameterTypeNames.length; i++) {
    Assert.checkNotNullArrayParam("parameterTypeNames", i, parameterTypeNames[i]);
  }
  hashCodeSetter.setInt(this, calcHashCode(methodName, parameterTypeNames));
}

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

/**
 * Construct a new instance.
 *
 * @param executors the initial list of executors to delegate to
 */
public BalancingExecutor(Executor... executors) {
  if (executors != null && executors.length > 0) {
    final Executor[] clone = executors.clone();
    for (int i = 0; i < clone.length; i++) {
      Assert.checkNotNullArrayParam("executors", i, clone[i]);
    }
    executorsUpdater.set(this, clone);
  } else {
    executorsUpdater.clear(this);
  }
}

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

/**
 * Create an aggregate role mapper.  Each role mapper is applied in order.
 *
 * @param mappers the role mappers to apply (most not be {@code null} or contain {@code null} elements)
 * @return the aggregate role mapper (not {@code null})
 */
static RoleMapper aggregate(RoleMapper... mappers) {
  Assert.checkNotNullParam("mappers", mappers);
  final RoleMapper[] clone = mappers.clone();
  for (int i = 0; i < clone.length; i++) {
    Assert.checkNotNullArrayParam("mappers", i, clone[i]);
  }
  return rolesToMap -> {
    for (RoleMapper r : clone) rolesToMap = r.mapRoles(rolesToMap);
    return rolesToMap;
  };
}

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

/**
 * Create a name rewriter which chains the given name rewriters; the name will be rewritten through the given rewriters
 * in order and then returned.  If any rewriter returns {@code null}, then {@code null} is returned.
 *
 * @param nameRewriters the name rewriters (must not be {@code null}, cannot have {@code null} elements)
 * @return the name rewriter (not {@code null})
 */
static NameRewriter chain(NameRewriter... nameRewriters) {
  Assert.checkNotNullParam("nameRewriters", nameRewriters);
  final NameRewriter[] clone = nameRewriters.clone();
  for (int i = 0; i < clone.length; i++) {
    Assert.checkNotNullArrayParam("nameRewriters", i, clone[i]);
  }
  return n -> {
    for (NameRewriter r : clone) {
      if (n == null) return null;
      n = r.rewriteName(n);
    }
    return n;
  };
}

代码示例来源: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

/**
 * Create a name rewriter which aggregates the given name rewriters; the first rewriter which successfully rewrites
 * the name is used.  If all the rewriters return {@code null}, then {@code null} is returned.
 *
 * @param nameRewriters the name rewriters (must not be {@code null}, cannot have {@code null} elements)
 * @return the name rewriter (not {@code null})
 */
static NameRewriter aggregate(NameRewriter... nameRewriters) {
  Assert.checkNotNullParam("nameRewriters", nameRewriters);
  final NameRewriter[] clone = nameRewriters.clone();
  for (int i = 0; i < clone.length; i++) {
    Assert.checkNotNullArrayParam("nameRewriters", i, clone[i]);
  }
  return n -> {
    if (n == null) return null;
    String rn;
    for (NameRewriter r : clone) {
      rn = r.rewriteName(n);
      if (rn != null) {
        return rn;
      }
    }
    return null;
  };
}

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

/**
 * Create a discovery object with the given providers.  The given {@code providers} argument and its array
 * elements may not be {@code null}.
 *
 * @param providers the discovery providers (must not be {@code null})
 * @return the discovery object
 */
public static Discovery create(DiscoveryProvider... providers) {
  Assert.checkNotNullParam("providers", providers);
  final DiscoveryProvider[] clone = providers.clone();
  final int length = clone.length;
  for (int i = 0; i < length; i++) {
    Assert.checkNotNullArrayParam("providers", i, clone[i]);
  }
  if (clone.length == 0) {
    return new Discovery(DiscoveryProvider.EMPTY);
  } else if (clone.length == 1) {
    return new Discovery(clone[0]);
  } else {
    return new Discovery(new AggregateDiscoveryProvider(clone));
  }
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron-sasl

MultiPredicate(final SaslMechanismPredicate[] predicates) {
  for (int i = 0; i < predicates.length; i++) {
    SaslMechanismPredicate predicate = predicates[i];
    Assert.checkNotNullArrayParam("predicates", i, predicate);
  }
  this.predicates = predicates;
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron

private CompositePrincipal(Principal[] principals, boolean clone) {
  p = principals.length == 0 ? NO_PRINCIPALS : clone ? principals.clone() : principals;
  for (int i = 0; i < p.length; i++) {
    Assert.checkNotNullArrayParam("principals", i, p[i]);
  }
}

代码示例来源:origin: org.wildfly.transaction/wildfly-transaction-client

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: org.wildfly.security/wildfly-elytron

AbstractX509CertificateChainCredential(X509Certificate... certificateChain) {
  Assert.checkNotNullParam("certificateChain", certificateChain);
  if (certificateChain.length > 0) {
    this.certificateChain = certificateChain.clone();
    final int length = this.certificateChain.length;
    for (int i = 0; i < length; i++) {
      Assert.checkNotNullArrayParam("certificateChain", i, this.certificateChain[i]);
    }
  } else {
    throw ElytronMessages.log.certificateChainIsEmpty();
  }
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron-credential

AbstractX509CertificateChainCredential(X509Certificate... certificateChain) {
  Assert.checkNotNullParam("certificateChain", certificateChain);
  if (certificateChain.length > 0) {
    this.certificateChain = certificateChain.clone();
    final int length = this.certificateChain.length;
    for (int i = 0; i < length; i++) {
      Assert.checkNotNullArrayParam("certificateChain", i, this.certificateChain[i]);
    }
  } else {
    throw ElytronMessages.log.certificateChainIsEmpty();
  }
}

代码示例来源:origin: wildfly/jboss-ejb-client

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);
}

相关文章