Methods Summary |
---|
public static PropertyAccessor | getDom4jPropertyAccessor(java.lang.String nodeName, org.hibernate.type.Type type, org.hibernate.engine.SessionFactoryImplementor factory)
//TODO: need some caching scheme? really comes down to decision
// regarding amount of state (if any) kept on PropertyAccessors
return new Dom4jAccessor( nodeName, type, factory );
|
public static PropertyAccessor | getDynamicMapPropertyAccessor()
return MAP_ACCESSOR;
|
private static PropertyAccessor | getPojoPropertyAccessor(java.lang.String pojoAccessorStrategy)Retreives a PropertyAccessor specific for a PojoRepresentation with the given access strategy.
if ( StringHelper.isEmpty( pojoAccessorStrategy ) || "property".equals( pojoAccessorStrategy ) ) {
return BASIC_PROPERTY_ACCESSOR;
}
else if ( "field".equals( pojoAccessorStrategy ) ) {
return DIRECT_PROPERTY_ACCESSOR;
}
else if ( "embedded".equals( pojoAccessorStrategy ) ) {
return EMBEDDED_PROPERTY_ACCESSOR;
}
else if ( "noop".equals(pojoAccessorStrategy) ) {
return NOOP_ACCESSOR;
}
else {
return resolveCustomAccessor( pojoAccessorStrategy );
}
|
public static PropertyAccessor | getPropertyAccessor(org.hibernate.mapping.Property property, org.hibernate.EntityMode mode)Retrieves a PropertyAccessor instance based on the given property definition and
entity mode.
//TODO: ideally we need the construction of PropertyAccessor to take the following:
// 1) EntityMode
// 2) EntityMode-specific data (i.e., the classname for pojo entities)
// 3) Property-specific data based on the EntityMode (i.e., property-name or dom4j-node-name)
// The easiest way, with the introduction of the new runtime-metamodel classes, would be the
// the following predicates:
// 1) PropertyAccessorFactory.getPropertyAccessor() takes references to both a
// org.hibernate.metadata.EntityModeMetadata and org.hibernate.metadata.Property
// 2) What is now termed a "PropertyAccessor" stores any values needed from those two
// pieces of information
// 3) Code can then simply call PropertyAccess.getGetter() with no parameters; likewise with
// PropertyAccessor.getSetter()
//TODO: this is temporary in that the end result will probably not take a Property reference per-se.
if ( null == mode || EntityMode.POJO.equals( mode ) ) {
return getPojoPropertyAccessor( property.getPropertyAccessorName() );
}
else if ( EntityMode.MAP.equals( mode ) ) {
return getDynamicMapPropertyAccessor();
}
else if ( EntityMode.DOM4J.equals( mode ) ) {
//TODO: passing null here, because this method is not really used for DOM4J at the moment
// but it is still a bug, if we don't get rid of this!
return getDom4jPropertyAccessor( property.getAccessorPropertyName( mode ), property.getType(), null );
}
else {
throw new MappingException( "Unknown entity mode [" + mode + "]" );
}
|
public static PropertyAccessor | getPropertyAccessor(java.lang.Class optionalClass, java.lang.String type)
if ( type==null ) type = optionalClass==null || optionalClass==Map.class ? "map" : "property";
return getPropertyAccessor(type);
|
public static PropertyAccessor | getPropertyAccessor(java.lang.String type)
if ( type==null || "property".equals(type) ) return BASIC_PROPERTY_ACCESSOR;
if ( "field".equals(type) ) return DIRECT_PROPERTY_ACCESSOR;
if ( "map".equals(type) ) return MAP_ACCESSOR;
if ( "embedded".equals(type) ) return EMBEDDED_PROPERTY_ACCESSOR;
if ( "noop".equals(type)) return NOOP_ACCESSOR;
return resolveCustomAccessor(type);
|
private static PropertyAccessor | resolveCustomAccessor(java.lang.String accessorName)
Class accessorClass;
try {
accessorClass = ReflectHelper.classForName(accessorName);
}
catch (ClassNotFoundException cnfe) {
throw new MappingException("could not find PropertyAccessor class: " + accessorName, cnfe);
}
try {
return (PropertyAccessor) accessorClass.newInstance();
}
catch (Exception e) {
throw new MappingException("could not instantiate PropertyAccessor class: " + accessorName, e);
}
|