Package org.neo4j.ogm.typeconversion
Class EnumCollectionStringConverter
java.lang.Object
org.neo4j.ogm.typeconversion.EnumCollectionStringConverter
- All Implemented Interfaces:
AttributeConverter<Collection<Enum>,
String[]>
public class EnumCollectionStringConverter
extends Object
implements AttributeConverter<Collection<Enum>,String[]>
By default the OGM will map enum collections to and from
the string collections containing values returned by enum.name()
enum.name() is preferred to enum.ordinal() because it
is (slightly) safer: a persisted enum have to be renamed
to break its database mapping, whereas if its ordinal
was persisted instead, the mapping would be broken
simply by changing the declaration order of the enum constants.
- Author:
- Luanne Misquitta, RĂ³bert Papp
-
Constructor Summary
ConstructorDescriptionEnumCollectionStringConverter
(Class<? extends Enum> enumClass, Class<? extends Collection> collectionClass) -
Method Summary
Modifier and TypeMethodDescriptiontoEntityAttribute
(String[] stringValues) String[]
toGraphProperty
(Collection<Enum> value)
-
Constructor Details
-
EnumCollectionStringConverter
public EnumCollectionStringConverter(Class<? extends Enum> enumClass, Class<? extends Collection> collectionClass)
-
-
Method Details
-
toGraphProperty
- Specified by:
toGraphProperty
in interfaceAttributeConverter<Collection<Enum>,
String[]>
-
toEntityAttribute
- Specified by:
toEntityAttribute
in interfaceAttributeConverter<Collection<Enum>,
String[]>
-