
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). |
TARGET_IMMUTABLE
Identical to
SETTER_PREFERRED, however the target collection will not be cleared and accessed via
addAll in case of updating existing bean instances, see: MappingTarget. |
| 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). This will also be the case when using
MappingTarget (updating existing instances).
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 final CollectionMappingStrategy TARGET_IMMUTABLE
SETTER_PREFERRED, however the target collection will not be cleared and accessed via
addAll in case of updating existing bean instances, see: MappingTarget.
Instead the target accessor (e.g. set) will be used on the target bean to set the collection.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-2019 MapStruct Authors; All rights reserved. Released under the Apache Software License 2.0.