org.compass.core.accessor
Class PropertyAccessorFactory

java.lang.Object
  extended by org.compass.core.accessor.PropertyAccessorFactory
All Implemented Interfaces:
CompassConfigurable

public class PropertyAccessorFactory
extends Object
implements CompassConfigurable

A factory that creates a PropertyAccessor.

Acts as a registry for property accessors, with two default implementations, BasicPropertyAccessor registered under "property", and DirectPropertyAccessor registered under "field".

Allows for configuration of new property accessors, and register them under new/same names. Configuration is using the CompassEnvironment.PropertyAccessor.

Author:
kimchy

Constructor Summary
PropertyAccessorFactory()
           
 
Method Summary
 void configure(CompassSettings settings)
          Configures the property accessor registry, using the two default ones (field and property), and any external registered ones.
 PropertyAccessor getPropertyAccessor(String type, CompassSettings settings)
          Returns a new property accessor that match the given type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyAccessorFactory

public PropertyAccessorFactory()
Method Detail

configure

public void configure(CompassSettings settings)
               throws CompassException
Configures the property accessor registry, using the two default ones (field and property), and any external registered ones.

Specified by:
configure in interface CompassConfigurable
Parameters:
settings - The settings for the configured object
Throws:
CompassException

getPropertyAccessor

public PropertyAccessor getPropertyAccessor(String type,
                                            CompassSettings settings)
                                     throws MappingException
Returns a new property accessor that match the given type. If the type is null will return the BasicPropertyAccessor. If the type can be found in the pre configured registry of property accessors, will return it. If nothing is found in the registry will try to instanciate it using the type as the class name.

Throws:
MappingException


Copyright (c) 2004-2009 The Compass Project.