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:de.cubeisland.engine.core.webapi.ApiServer.java
public void setAuthorizedList(Set<InetAddress> newAuthorizedlist) { expectNotNull(newAuthorizedlist, "The autorizedlist must not be null!"); Validate.noNullElements(newAuthorizedlist, "The autorizedlist must not contain null values!"); this.authorizedList.clear(); this.authorizedList.addAll(newAuthorizedlist); }
From source file:com.opengamma.analytics.math.surface.InterpolatedFromCurvesDoublesSurface.java
/** * @param xzCurves Do the curves lie in the <i>x-z</i> plane or the <i>y-z</i> plane. * @param points An array of points of intersection of the curves on the remaining axis (e.g. if the curves are in the <i>x-z</i> plane, the points indicate where * the curves cross the <i>y</i> axis). Not null * @param curves An array of curves, not null, must be the same length as the array of points of intersection * @param interpolator The interpolator// w w w .j a va2 s. c om * @param isSorted Are the intersection points of the curve sorted in increasing order * @param name The name of the surface */ public InterpolatedFromCurvesDoublesSurface(final boolean xzCurves, final double[] points, final Curve<Double, Double>[] curves, final Interpolator1D interpolator, final boolean isSorted, final String name) { super(name); Validate.notNull(points, "points"); Validate.notNull(curves, "curves"); final int n = points.length; Validate.isTrue(points.length > 0 && points.length == curves.length); Validate.noNullElements(curves, "curves"); Validate.notNull(interpolator, "interpolator"); _xzCurves = xzCurves; _points = Arrays.copyOf(points, n); _curves = Arrays.copyOf(curves, n); _nCurves = n; _interpolator = interpolator; if (!isSorted) { ParallelArrayBinarySort.parallelBinarySort(_points, _curves); } }
From source file:com.opengamma.analytics.math.cube.InterpolatedFromSurfacesDoublesCube.java
/** * @param plane The plane in which the surfaces lie * @param points An array of points of intersection of the surfaces on the remaining axis (e.g. if the surfaces are in the <i>x-y</i> plane, the points indicate where * the surfaces cross the <i>z</i> axis). Not null * @param surfaces An array of surfaces, not null, must be the same length as the array of points of intersection * @param interpolator The interpolator// w w w . j a v a2s. com * @param isSorted Is the intersection point data sorted * @param name The name of the cube */ public InterpolatedFromSurfacesDoublesCube(final SurfacePlane plane, final double[] points, final Surface<Double, Double, Double>[] surfaces, final Interpolator1D interpolator, final boolean isSorted, final String name) { super(name); Validate.notNull(plane, "plane"); Validate.notNull(points, "points"); Validate.notNull(surfaces, "surfaces"); final int n = points.length; Validate.isTrue(n > 0); Validate.isTrue(n == surfaces.length); Validate.noNullElements(surfaces, "surfaces"); Validate.notNull(interpolator, "interpolator"); _plane = plane; _points = Arrays.copyOf(points, n); _surfaces = Arrays.copyOf(surfaces, n); _nSurfaces = n; _interpolator = interpolator; if (!isSorted) { ParallelArrayBinarySort.parallelBinarySort(_points, _surfaces); } }
From source file:org.apereo.portal.url.AbstractUrlBuilder.java
public AbstractUrlBuilder() { this.parameters = MapConstraints.constrainedMap(new ParameterMap(), new MapConstraint<String, String[]>() { @Override// w ww .j a v a 2 s . c o m public void checkKeyValue(String key, String[] value) { Validate.notNull(key, "name can not be null"); Validate.noNullElements(value, "values can not be null or contain null elements"); } }); }
From source file:org.apereo.portal.url.PortletUrlBuilder.java
public PortletUrlBuilder(IPortletWindowId portletWindowId, IPortalUrlBuilder portalUrlBuilder) { Preconditions.checkNotNull(portletWindowId, "IPortletWindowId can not be null"); Preconditions.checkNotNull(portalUrlBuilder, "IPortalUrlBuilder can not be null"); this.portletWindowId = portletWindowId; this.portalUrlBuilder = portalUrlBuilder; this.urlType = this.portalUrlBuilder.getUrlType(); this.publicRenderParameters = MapConstraints.constrainedMap(new ParameterMap(), new MapConstraint<String, String[]>() { @Override//from w ww . j a v a2 s . c om public void checkKeyValue(String key, String[] value) { Validate.notNull(key, "name can not be null"); Validate.noNullElements(value, "values can not be null or contain null elements"); } }); }
From source file:org.apereo.portal.url.processing.RequestParameterProcessorInterceptor.java
/** * @param dynamicRequestParameterProcessors the dynamicRequestParameterProcessors to set * @throws IllegalArgumentException if the List is null or contains null elements *///w w w. j a va2 s. c o m public void setDynamicRequestParameterProcessors( List<IRequestParameterProcessor> dynamicRequestParameterProcessors) { Validate.notNull(dynamicRequestParameterProcessors, "IRequestParameterProcessor List can not be null"); Validate.noNullElements(dynamicRequestParameterProcessors, "IRequestParameterProcessor List can not contain a null element"); this.dynamicRequestParameterProcessors = dynamicRequestParameterProcessors; }
From source file:org.apereo.portal.url.UrlStringBuilder.java
/** * Removes any existing path elements and sets the provided elements as the path * //w ww. j av a 2 s . c o m * @param elements Path elements to set * @return this */ public UrlStringBuilder setPath(String... elements) { Validate.noNullElements(elements, "elements cannot be null"); this.path.clear(); this.addPath(elements); return this; }
From source file:org.apereo.portal.url.UrlStringBuilder.java
/** * Adds the provided elements to the path * /* www . ja va 2 s. c om*/ * @param elements Path elements to add * @return this */ public UrlStringBuilder addPath(String... elements) { Validate.noNullElements(elements, "elements cannot be null"); for (final String element : elements) { this.path.add(element); } return this; }
From source file:org.beangle.security.auth.AbstractAuthentication.java
public AbstractAuthentication(Collection<? extends GrantedAuthority> authorities) { if (authorities == null) { this.authorities = Collections.emptyList(); } else {// w w w . j a va 2 s. c om Validate.noNullElements(authorities, "authorities cannot contain any null element"); this.authorities = Collections.unmodifiableCollection(CollectUtils.newArrayList(authorities)); } }
From source file:org.codehaus.httpcache4j.Directive.java
public Directive(final String name, String value, List<Parameter> parameters) { super(name, HeaderUtils.fixQuotedString(value)); Validate.notNull(parameters, "Parameters may not be null"); Validate.noNullElements(parameters, "Parameters may not contain any null elements"); this.parameters = ImmutableList.copyOf(parameters); }