Package org.neo4j.ogm.typeconversion
Class EnumStringConverter
java.lang.Object
org.neo4j.ogm.typeconversion.EnumStringConverter
- All Implemented Interfaces:
AttributeConverter<Enum,
String>
By default the OGM will map enum objects to and from
the string value 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:
- Vince Bickers, Gerrit Meier, RĂ³bert Papp
-
Constructor Summary
ConstructorDescriptionEnumStringConverter
(Class<? extends Enum> enumClass) EnumStringConverter
(Class<? extends Enum> enumClass, boolean lenient) -
Method Summary
-
Constructor Details
-
EnumStringConverter
-
EnumStringConverter
-
-
Method Details
-
toGraphProperty
- Specified by:
toGraphProperty
in interfaceAttributeConverter<Enum,
String>
-
toEntityAttribute
- Specified by:
toEntityAttribute
in interfaceAttributeConverter<Enum,
String>
-