List of usage examples for org.apache.commons.lang Validate noNullElements
public static void noNullElements(Collection collection, String message)
Validate an argument, throwing IllegalArgumentException
if the argument Collection has null
elements or is null
.
Validate.noNullElements(myCollection, "The collection must not contain null elements");
If the collection is null then the message in the exception is 'The validated object is null'.
From source file:org.xcmis.search.model.operand.DynamicOperand.java
/** * Create a arithmetic dynamic operand that operates upon the supplied * selector name(s)./*from w w w . j av a2s. c om*/ * * @param selectorNames * the selector names */ protected DynamicOperand(SelectorName... selectorNames) { if (selectorNames.length == 1) { Validate.notNull(selectorNames, "The selectorNames argument may not be null"); this.selectorNames = Collections.singleton(selectorNames[0]); } else { Validate.noNullElements(selectorNames, "The selectorNames argument may not be null"); this.selectorNames = Collections .unmodifiableSet(new LinkedHashSet<SelectorName>(Arrays.asList(selectorNames))); } this.hcode = new HashCodeBuilder().append(selectorNames).toHashCode(); }
From source file:se.vgregion.urlservice.types.Bookmark.java
public Bookmark(String hash, LongUrl longUrl, List<Keyword> keywords, Owner owner) { this.id = UUID.randomUUID(); Validate.notEmpty(hash, "hash can not be empty"); Validate.notNull(longUrl, "longUrl can not be null"); Validate.notNull(owner, "owner can not be null"); Validate.noNullElements(keywords, "Keyword element can not be null"); this.hash = hash; this.longUrl = longUrl; this.keywords = keywords; this.owner = owner; longUrl.addBookmark(this); owner.addShortLink(this); }