/** * 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; }
public MessageTracker(final Channel channel, final int limit) { Assert.checkNotNullParam("channel", channel); Assert.checkMinimumParameter("limit", 1, limit); this.channel = channel; counter = limit; }
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); } }
/** * 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; }
AbstractEJBMetaData(final Class<T> remoteInterfaceClass, final EJBHomeLocator<H> homeLocator) { Assert.checkNotNullParam("remoteInterfaceClass", remoteInterfaceClass); Assert.checkNotNullParam("homeLocator", homeLocator); this.remoteInterfaceClass = remoteInterfaceClass; this.homeLocator = homeLocator; }
SecurityIdentity transform(final SecurityIdentity securityIdentity) { Assert.checkNotNullParam("securityIdentity", securityIdentity); return Assert.assertNotNull(securityIdentityTransformer.apply(securityIdentity)); }
Assert.checkNotNullParam("type", type); if (value == null) return getNullReference(); switch (type) { return getNullReference(); default: throw Assert.impossibleSwitchCase(type);
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; }
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); }
void lock(Object key) { Assert.assertNotNull(key); if (! lockRef.compareAndSet(null, key)) { throw new SecurityException("Selector is locked"); } }
public ConnectionBuilder setHeartbeatInterval(final int heartbeatInterval) { Assert.checkMinimumParameter("heartbeatInterval", 1, heartbeatInterval); this.heartbeatInterval = heartbeatInterval; return this; }
/** * Not supported. * * @return nothing * @throws UnsupportedOperationException always */ public String readLine() throws UnsupportedOperationException { throw Assert.unsupported(); }
public LdapSecurityRealmBuilder build() { assertNotBuilt(); Assert.checkNotEmptyParam("certificateVerifiers", certificateVerifiers); built = true; addEvidenceVerifier(new X509EvidenceVerifier(certificateVerifiers)); return LdapSecurityRealmBuilder.this; }
ContextPermission(final String name, final int actionBits) { super(name); Assert.checkNotNullParam("name", name); this.actionBits = actionBits & ACTION_ALL; }
/** * 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; } } } }
Assert.checkNotNullParam("type", type); if (value == null) return getNullReference(); switch (type) { return getNullReference(); default: throw Assert.impossibleSwitchCase(type);
void unlock(Object key) { Assert.assertNotNull(key); if (! lockRef.compareAndSet(key, null)) { throw new SecurityException("Selector could not be unlocked"); } } }
/** * 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; }
/** * Unsupported. */ public void remove() { throw Assert.unsupported(); }
/** * 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]; }