Class AggregatePath.ColumnInfos
java.lang.Object
org.springframework.data.relational.core.mapping.AggregatePath.ColumnInfos
- Enclosing interface:
AggregatePath
A group of
AggregatePath.ColumnInfo values referenced by there respective AggregatePath. It is used in a similar
way as ColumnInfo when one needs to consider more than a single column. This is relevant for composite
ids and references to such ids.- Since:
- 4.0
- Author:
- Jens Schauder, Mark Paluch
-
Method Summary
Modifier and TypeMethodDescriptionany()Any of the containedAggregatePath.ColumnInfoinstances.<T> Tany(BiFunction<AggregatePath, AggregatePath.ColumnInfo, T> mapper) Calls the mapper for each pair one pair ofAggregatePathandAggregatePath.ColumnInfo, if there is any.static AggregatePath.ColumnInfosempty()An empty ColumnInfos instance with a fixed base path.voidforEach(BiConsumer<AggregatePath, AggregatePath.ColumnInfo> consumer) Calls the consumer for each pair ofAggregatePathand ColumnInfo.@Nullable AggregatePath.ColumnInfoget(AggregatePath path) Gets theAggregatePath.ColumnInfofor the providedAggregatePathbooleanisEmpty()Checks if this instance is empty, i.e. does not contain anyAggregatePath.ColumnInfoinstance.paths()Return anIterableofAggregatePathassociated with this column infos.<T> Treduce(T identity, BiFunction<AggregatePath, AggregatePath.ColumnInfo, T> accumulator, BinaryOperator<T> combiner) Performs aStream.reduce(Object, BiFunction, BinaryOperator)onAggregatePath.ColumnInfoandAggregatePathto reduce the results into a singleTreturn value.intsize()Number of ColumnInfo elements in this instance.toColumnList(BiFunction<AggregatePath, AggregatePath.ColumnInfo, Column> mappingFunction) Creates aListofColumninstances by applying the provided mapping function to eachAggregatePathandAggregatePath.ColumnInfo.toColumnList(Table table) unique()If this instance contains exactly oneAggregatePath.ColumnInfoit will be returned.
-
Method Details
-
empty
An empty ColumnInfos instance with a fixed base path. Useful as a base when collectingAggregatePath.ColumnInfoinstances into an ColumnInfos instance.- Returns:
- an empty instance save the basePath.
-
unique
If this instance contains exactly oneAggregatePath.ColumnInfoit will be returned.- Returns:
- the unique ColumnInfo if present.
- Throws:
IllegalStateException- if the number of contained ColumnInfo instances is not exactly 1.
-
any
Any of the containedAggregatePath.ColumnInfoinstances.- Returns:
- a
AggregatePath.ColumnInfoinstance. - Throws:
NoSuchElementException- if no instance is available.
-
toMap
- Parameters:
table-- Returns:
- a
MapofAggregatePathtoColumns. - Since:
- 4.0
-
toColumnList
Converts the givenTableinto a list ofColumns. This method retrieves and caches the list of columns for the specified table. If the columns are not already cached, it computes the list by mappingcolumnInfosto their correspondingColumnin the provided table and then stores the result in the cache. -
toColumnList
public List<Column> toColumnList(BiFunction<AggregatePath, AggregatePath.ColumnInfo, Column> mappingFunction) Creates aListofColumninstances by applying the provided mapping function to eachAggregatePathandAggregatePath.ColumnInfo.- Parameters:
mappingFunction- function to mapAggregatePathandAggregatePath.ColumnInfoto aColumn.- Returns:
- a list of
Columns. - Since:
- 4.0
-
reduce
public <T> T reduce(T identity, BiFunction<AggregatePath, AggregatePath.ColumnInfo, T> accumulator, BinaryOperator<T> combiner) Performs aStream.reduce(Object, BiFunction, BinaryOperator)onAggregatePath.ColumnInfoandAggregatePathto reduce the results into a singleTreturn value.If
ColumnInfosis empty, thenidentityis returned. Without invokingcombiner. Thecombineris called with the current state (or initialidentity) and the accumulatedTstate to combine both into a single return value.- Type Parameters:
T- type of the result.- Parameters:
identity- the identity (initial) value for the combiner function.accumulator- an associative, non-interfering (free of side effects), stateless function for incorporating an additional element into a result.combiner- an associative, non-interfering, stateless function for combining two values, which must be compatible with theaccumulatorfunction.- Returns:
- result of the function.
- Since:
- 4.0
-
forEach
Calls the consumer for each pair ofAggregatePathand ColumnInfo.- Parameters:
consumer- the function to call.
-
any
Calls the mapper for each pair one pair ofAggregatePathandAggregatePath.ColumnInfo, if there is any.- Parameters:
mapper- the function to call.- Returns:
- the result of the mapper
- Throws:
NoSuchElementException- if this ColumnInfo is empty.
-
get
Gets theAggregatePath.ColumnInfofor the providedAggregatePath- Parameters:
path- for which to return the ColumnInfo- Returns:
- ColumnInfo for the given path.
-
paths
Return anIterableofAggregatePathassociated with this column infos.- Returns:
-
isEmpty
public boolean isEmpty()Checks if this instance is empty, i.e. does not contain anyAggregatePath.ColumnInfoinstance.- Returns:
- true iff the collection of ColumnInfo is empty.
-
size
public int size()Number of ColumnInfo elements in this instance.- Returns:
- the size of the collection of ColumnInfo.
-