T - value typepublic class CollectionConstraint<T> extends Object implements Constraint<T>
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
| Modifier and Type | Field and Description |
|---|---|
protected Collection<T> |
objects
Acceptable objects.
|
| Constructor and Description |
|---|
CollectionConstraint(Collection<T> objects) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(T value)
Checks whether the value complies with constraints.
|
String |
failMessage()
Returns a message for value failure, pointing to a parameter using '%s'.
|
static <T> CollectionConstraint<T> |
newInstance(T... objs)
Creates a new instance with given objects.
|
String |
toString() |
protected final Collection<T> objects
public CollectionConstraint(Collection<T> objects)
objects - Collection<T>; acceptable objectspublic boolean accept(T value)
accept in interface Constraint<T>value - T; Value to check.public String failMessage()
failMessage in interface Constraint<T>@SafeVarargs public static <T> CollectionConstraint<T> newInstance(T... objs)
T - typeobjs - T...; acceptable objectsCopyright © 2014–2019 Delft University of Technology. All rights reserved.