MultiPredicate(final SaslMechanismPredicate[] predicates) { for (int i = 0; i < predicates.length; i++) { SaslMechanismPredicate predicate = predicates[i]; Assert.checkNotNullArrayParam("predicates", i, predicate); } this.predicates = predicates; }
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]); } }
/** * 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; }
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; }
/** * 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); }
/** * 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); } }
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(); } }
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)); }
/** * 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); } }
/** * 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; }; }
/** * 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; }; }
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); }
/** * 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; }; }
/** * 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)); } }
MultiPredicate(final SaslMechanismPredicate[] predicates) { for (int i = 0; i < predicates.length; i++) { SaslMechanismPredicate predicate = predicates[i]; Assert.checkNotNullArrayParam("predicates", i, predicate); } this.predicates = predicates; }
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]); } }
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; }
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(); } }
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(); } }
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); }