package org.hibernate.property.access.spi;
import org.hibernate.property.access.internal.PropertyAccessStrategyBasicImpl;
import org.hibernate.property.access.internal.PropertyAccessStrategyEmbeddedImpl;
import org.hibernate.property.access.internal.PropertyAccessStrategyFieldImpl;
import org.hibernate.property.access.internal.PropertyAccessStrategyMapImpl;
import org.hibernate.property.access.internal.PropertyAccessStrategyMixedImpl;
import org.hibernate.property.access.internal.PropertyAccessStrategyNoopImpl;
public enum BuiltInPropertyAccessStrategies {
BASIC( "property", PropertyAccessStrategyBasicImpl.INSTANCE ),
FIELD( "field", PropertyAccessStrategyFieldImpl.INSTANCE ),
MIXED( "mixed", PropertyAccessStrategyMixedImpl.INSTANCE ),
MAP( "map", PropertyAccessStrategyMapImpl.INSTANCE ),
EMBEDDED( "embedded", PropertyAccessStrategyEmbeddedImpl.INSTANCE ),
NOOP( "noop", PropertyAccessStrategyNoopImpl.INSTANCE )
;
private final String externalName;
private final PropertyAccessStrategy strategy;
BuiltInPropertyAccessStrategies(String externalName, PropertyAccessStrategy strategy) {
this.externalName = externalName;
this.strategy = strategy;
}
public String getExternalName() {
return externalName;
}
public PropertyAccessStrategy getStrategy() {
return strategy;
}
public static BuiltInPropertyAccessStrategies interpret(String name) {
if ( BASIC.externalName.equals( name ) ) {
return BASIC;
}
else if ( FIELD.externalName.equals( name ) ) {
return FIELD;
}
else if ( MAP.externalName.equals( name ) ) {
return MAP;
}
else if ( EMBEDDED.externalName.equals( name ) ) {
return EMBEDDED;
}
else if ( NOOP.externalName.equals( name ) ) {
return NOOP;
}
return null;
}
}