List of usage examples for org.apache.commons.lang Validate noNullElements
public static void noNullElements(Collection collection)
Validate an argument, throwing IllegalArgumentException
if the argument Collection has null
elements or is null
.
Validate.noNullElements(myCollection);
The message in the exception is 'The validated collection contains null element at index: '.
If the collection is null then the message in the exception is 'The validated object is null'.
From source file:ar.com.zauber.commons.facebook.utils.impl.DefaultCallbackRequestValidator.java
/** * Creates the DefaultCallbackRequestValidator. * * @param secrets API secrets/*from w ww . j a v a 2 s. c o m*/ */ public DefaultCallbackRequestValidator(final List<String> secrets) { Validate.noNullElements(secrets); this.secrets = secrets; }
From source file:ar.com.zauber.commons.web.proxy.impl.dao.behaviour.impl.MapURLRequestMapperAssertionsDAO.java
/** constructor */ public MapURLRequestMapperAssertionsDAO(final List<URLRequestMapperAssertion> assertions) { Validate.noNullElements(assertions); for (URLRequestMapperAssertion assertion : assertions) { Validate.notNull(assertion);/*from w w w .j a v a 2 s. c om*/ this.assertions.put(assertion.getId(), assertion); } }
From source file:io.tilt.minka.business.leader.distributor.ClassicalPartitionSolver.java
public List<List<ShardDuty>> balance(final int shards, final List<ShardDuty> weightedDuties) { Validate.isTrue(shards > 1);//from w w w . j a v a 2 s .c o m Validate.noNullElements(weightedDuties); final int[] indexes = buildIndexes(weightedDuties, shards); final List<List<ShardDuty>> distro = new ArrayList<>(); int fromIdx = 0; for (int idx : indexes) { distro.add(discoverFormedGroups(weightedDuties, fromIdx, idx)); fromIdx = idx; } if (indexes[indexes.length - 1] < weightedDuties.size()) { distro.add(discoverFormedGroups(weightedDuties, fromIdx, weightedDuties.size())); } logDistributionResult(distro); return distro; }
From source file:ar.com.zauber.commons.exception.interceptors.NotificationExceptionHandler.java
/** constructor */ public NotificationExceptionHandler(final NotificationStrategy notificationStrategy, final MessageFactory messageFactory, final NotificationAddress[] receivers) { Validate.notNull(notificationStrategy); Validate.notNull(messageFactory);/* w w w . ja v a 2 s .c om*/ Validate.noNullElements(receivers); this.notificationStrategy = notificationStrategy; this.messageFactory = messageFactory; this.receivers = receivers; }
From source file:ar.com.zauber.commons.web.proxy.impl.ChainedURLRequestMapper.java
/** Creates the ChainedURLRequestMapper. */ public ChainedURLRequestMapper(final List<URLRequestMapper> chain) { Validate.noNullElements(chain); this.chain = chain; }
From source file:ar.com.zauber.commons.message.message.templates.AbstractTemplate.java
/** @see #extraModel */ public final void setExtraModel(final Map<String, Object> extraModel) { Validate.notNull(extraModel);//from ww w . j av a2s.c om Validate.noNullElements(extraModel.keySet()); Validate.noNullElements(extraModel.values()); this.extraModel = extraModel; }
From source file:de.gmorling.scriptabledataset.ScriptableDataSet.java
/** * Creates a new ScriptableDataSet./*from w w w .java2 s. c o m*/ * * @param wrapped * Another data set to be wrapped by this scriptable data set. * Must not be null. * @param configurations * At least one scriptable data set configuration. */ public ScriptableDataSet(IDataSet wrapped, ScriptableDataSetConfig... configurations) { Validate.notNull(wrapped); Validate.notNull(configurations); Validate.noNullElements(configurations); Validate.notEmpty(configurations); this.wrapped = wrapped; this.configurations = Arrays.asList(configurations); }
From source file:domain.document.information.DocumentManagement.java
public void AddDocumentToSearchIndex(final List<Document> document) throws IOException { Validate.noNullElements(document); List<DocumentIndexInformation> indexInformationList = document.stream() .map(this::createDocumentIndexInformation).collect(Collectors.toList()); fullTextSearchResource.addDocumentsToIndex(indexInformationList); }
From source file:com.vmware.identity.saml.config.Config.java
/** * * Creates a new configuration/* w w w. j a v a 2s . c om*/ * * @param samlAuthorityConfig * Saml authority configuration properties, required * @param tokenRestrictions * token issuance configuration properties, required * @param validCerts * not empty array of SAML authority certificates, required. No * assumptions should be made for the order of the certificate * chains. However, within certificate chains, the certificates are * ordered from leaf to root CA. Entire chains can be kept even if * some of them is no longer valid, because when certificate is * checked if it is signed with a certificate among those chains, * this certificate will be no longer valid itself. required * @param clockTolerance * Maximum allowed clock skew between token sender and consumer, in * milliseconds, required. * @param inExternalIdps a list of external idps registered. * @throws IllegalArgumentException * when some of the arguments are invalid */ public Config(SamlAuthorityConfiguration samlAuthorityConfig, TokenRestrictions tokenRestrictions, Collection<List<Certificate>> validCerts, long clockTolerance, Collection<IDPConfig> inExternalIdps) { Validate.notNull(samlAuthorityConfig); Validate.notNull(tokenRestrictions); Validate.notEmpty(validCerts); List<Certificate> authorityCert = samlAuthorityConfig.getSigningCertificateChain(); boolean authorityCertInValidCerts = false; for (List<Certificate> currentChain : validCerts) { Validate.notEmpty(currentChain); Validate.noNullElements(currentChain); if (!authorityCertInValidCerts && currentChain.equals(authorityCert)) { authorityCertInValidCerts = true; } } Validate.isTrue(authorityCertInValidCerts, "signing certificate chain is not in valid chains."); Validate.isTrue(clockTolerance >= 0); this.samlAuthorityConfig = samlAuthorityConfig; this.validCerts = validCerts; this.clockTolerance = clockTolerance; this.tokenRestrictions = tokenRestrictions; HashMap<String, IDPConfig> idpsSet = new HashMap<String, IDPConfig>(); if (inExternalIdps != null) { for (IDPConfig conf : inExternalIdps) { if (conf != null) { idpsSet.put(conf.getEntityID(), conf); } } } this.externalIdps = Collections.unmodifiableMap(idpsSet); }
From source file:ar.com.zauber.commons.repository.utils.SpringInjectionInterceptor.java
/** * @param persistibleClasses persistible classes that may requiere dependency * injection/*from w w w .ja va 2s . c o m*/ */ public SpringInjectionInterceptor(final List<Class<?>> persistibleClasses) { Validate.noNullElements(persistibleClasses); for (final Class<?> clazz : persistibleClasses) { final List<Entry<Field, String>> fields = new LinkedList<Entry<Field, String>>(); for (final Annotation annotation : clazz.getAnnotations()) { if (annotation instanceof Configurable) { final List<Field> clazzFields = new LinkedList<Field>(); Class<?> c = clazz; while (c != null) { clazzFields.addAll(Arrays.asList(c.getDeclaredFields())); c = c.getSuperclass(); } for (final Field field : clazzFields) { for (final Annotation a : field.getAnnotations()) { if (a instanceof Qualifier) { String n = ((Qualifier) a).value(); if (StringUtils.isBlank(n)) { n = field.getName(); } final String name = n; fields.add(new Entry<Field, String>() { public Field getKey() { return field; } public String getValue() { return name; } public String setValue(final String value) { return null; } }); } } } } } if (fields.size() > 0) { dependencyCache.put(clazz, new DependencyInjection(fields, InitializingBean.class.isAssignableFrom(clazz))); } } }