Package com.identityworksllc.iiq.common
Class MapTupleBuilder
- java.lang.Object
-
- com.identityworksllc.iiq.common.MapTupleBuilder
-
public class MapTupleBuilder extends Object
A builder for MapTuple objects.These are objects that function as tuples, allowing access by either index or by key. To use this class, construct a new instance at the top of your operation, such as:
MapTupleBuilder mtb = new MapTupleBuilder(“identity”, “accountName”, “date”);
Then, for each item, such as from a ResultSet, do this:
MapTuple tuple = mtb.of(resultSet.getString(“identity”), resultSet.getString(“name”), resultSet.getDate(“created”));
In this example, the value for ‘identity’ can be accessed any of these ways:
tuple.get(“identity”); tuple.getAt(0); tuple.getFirst();
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MapTupleof(Object... values)Constructs aMapTuplepairing this builder’s keys with the given values, both in order.MapTupleofList(List<Object> values)Constructs aMapTuplepairing this builder’s keys with the given values, both in order.static MapTupleBuilderwithKeys(String... keys)Constructs a new MapTupleBuilder with the keys in the list.static MapTupleBuilderwithKeys(List<String> keys)Constructs a new MapTupleBuilder with the keys in the list.
-
-
-
Method Detail
-
withKeys
public static MapTupleBuilder withKeys(String... keys)
Constructs a new MapTupleBuilder with the keys in the list.- Parameters:
keys- At least one key to use in the resulting tuples- Returns:
- A builder with the given keys
-
withKeys
public static MapTupleBuilder withKeys(List<String> keys)
Constructs a new MapTupleBuilder with the keys in the list.- Parameters:
keys- A list containing at least one non-null key to use the resulting tuples- Returns:
- A builder with the given keys
-
of
public MapTuple of(Object... values)
Constructs aMapTuplepairing this builder’s keys with the given values, both in order.The number of values must match the number of keys.
- Parameters:
values- The values to add- Returns:
- The resulting map
-
-