public enum CollectionMappingStrategy extends Enum<CollectionMappingStrategy>
Enum Constant and Description |
---|
ACCESSOR_ONLY
The setter of the target property will be used to propagate the value:
orderDto.setOrderLines(order.getOrderLines) . |
ADDER_PREFERRED
Identical to
SETTER_PREFERRED , only that adder methods will be preferred over setter methods, if both
are present for a given collection-typed property. |
SETTER_PREFERRED
If present, the setter of the target property will be used to propagate the value:
orderDto.setOrderLines(order.getOrderLines) . |
Modifier and Type | Method and Description |
---|---|
static CollectionMappingStrategy |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static CollectionMappingStrategy[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final CollectionMappingStrategy ACCESSOR_ONLY
orderDto.setOrderLines(order.getOrderLines)
.
If no setter is available but a getter method, this will be used, under the assumption it has been initialized:
orderDto.getOrderLines().addAll(order.getOrderLines)
.
public static final CollectionMappingStrategy SETTER_PREFERRED
orderDto.setOrderLines(order.getOrderLines)
.
If no setter but and adder method is present, that adder will be invoked for each element of the source
collection: order.addOrderLine(orderLine() )
.
If neither a setter nor an adder method but a getter for the target property is present, that getter will be used, assuming it returns an initialized collection: If no setter is available, MapStruct will first look for an adder method before resorting to a getter.
public static final CollectionMappingStrategy ADDER_PREFERRED
SETTER_PREFERRED
, only that adder methods will be preferred over setter methods, if both
are present for a given collection-typed property.public static CollectionMappingStrategy[] values()
for (CollectionMappingStrategy c : CollectionMappingStrategy.values()) System.out.println(c);
public static CollectionMappingStrategy valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullCopyright © 2012-2016 Gunnar Morling; All rights reserved. Released under the Apache Software License 2.0.