private PropertyAccessor buildPropertyAccessor(Property property) { //TODO: currently we don't know a SessionFactory reference when building the Tuplizer // THIS IS A BUG (embedded-xml=false on component) return PropertyAccessorFactory.getDom4jPropertyAccessor( property.getNodeName(), property.getType(), null ); }
/** * Retrieves a PropertyAccessor instance based on the given property definition and * entity mode. * * @param property The property for which to retrieve an accessor. * @param mode The mode for the resulting entity. * @return An appropriate accessor. * @throws MappingException */ public static PropertyAccessor getPropertyAccessor(Property property, EntityMode mode) throws MappingException { //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 + "]" ); } } /** * Retreives a PropertyAccessor specific for a PojoRepresentation with the given access strategy.
/** * Retrieves a PropertyAccessor instance based on the given property definition and * entity mode. * * @param property The property for which to retrieve an accessor. * @param mode The mode for the resulting entity. * @return An appropriate accessor. * @throws MappingException */ public static PropertyAccessor getPropertyAccessor(Property property, EntityMode mode) throws MappingException { //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 + "]" ); } } /** * Retreives a PropertyAccessor specific for a PojoRepresentation with the given access strategy.
private PropertyAccessor buildPropertyAccessor(Property mappedProperty) { if ( mappedProperty.isBackRef() ) { return mappedProperty.getPropertyAccessor(null); } else { return PropertyAccessorFactory.getDom4jPropertyAccessor( mappedProperty.getNodeName(), mappedProperty.getType(), getEntityMetamodel().getSessionFactory() ); } }