Package io.permazen.tuple
Class Tuples
java.lang.Object
io.permazen.tuple.Tuples
Tuple utility methods.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Tuple
createTuple
(Iterable<?> values) Create aTuple
of the appropriate cardinality for the given number of objects.static Tuple
createTuple
(Object... values) Create aTuple
of the appropriate cardinality for the given number of objects.tupleClassForSize
(int size) Get theTuple
subinterface having the specified cardinality.static int
tupleSizeOf
(Class<? extends Tuple> tupleClass) Get the cardinality of the givenTuple
subtype.
-
Method Details
-
createTuple
Create aTuple
of the appropriate cardinality for the given number of objects.- Parameters:
values
- tuple values- Returns:
- newly created tuple
- Throws:
IllegalArgumentException
- ifvalues
is null or emptyUnsupportedOperationException
- ifvalues
has more elements than exist concreteTuple
classes
-
createTuple
Create aTuple
of the appropriate cardinality for the given number of objects.- Parameters:
values
- tuple values- Returns:
- newly created tuple
- Throws:
IllegalArgumentException
- ifvalues
is null or emptyUnsupportedOperationException
- ifvalues
has more elements than exist concreteTuple
classes
-
tupleClassForSize
Get theTuple
subinterface having the specified cardinality.- Parameters:
size
- number of objects in the tuple- Returns:
Tuple
subinterface with cardinalitysize
- Throws:
IllegalArgumentException
- ifsize
is less than oneUnsupportedOperationException
- ifsize
is more than exist concreteTuple
classes
-
tupleSizeOf
Get the cardinality of the givenTuple
subtype.- Parameters:
tupleClass
- tuple class- Returns:
- cardinality of
tupleClass
- Throws:
IllegalArgumentException
- iftupleClass
is not a recognized tuple class
-