org.ops4j.pax.reflector.typehandlers
Class AbstractObjectTypeHandler

java.lang.Object
  extended by org.ops4j.pax.reflector.typehandlers.AbstractObjectTypeHandler
All Implemented Interfaces:
TypeHandler
Direct Known Subclasses:
ObjectTypeHandler

public abstract class AbstractObjectTypeHandler
extends Object
implements TypeHandler


Field Summary
protected  SystemSettings m_SystemSettings
           
 
Constructor Summary
AbstractObjectTypeHandler()
           
 
Method Summary
 Class getMemberClass(Object container, String memberName)
          Returns the Class of the member.
 Object getMemberObject(Object container, String memberName)
          Returns the object that is assigned to the member of the provided container.
protected  void getNames(Set names, Class clazz)
           
protected  void getNames(Set names, Object container)
           
 SystemSettings getSystemSettings()
          Returns the System Settings that has been set to the TypeHandler.
 boolean isMemberSettable(Object container, String memberName)
          Returns true if the member is settable.
protected  String[] packageNames(Set names)
           
 void setMemberObject(Object container, String member, Object value)
          Sets the member of a container to the provided value.
 void setSystemSettings(SystemSettings settings)
          Sets the SystemSettings to this TypeHandler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ops4j.pax.reflector.spi.TypeHandler
canHandle, getMemberNames, getSeparator
 

Field Detail

m_SystemSettings

protected SystemSettings m_SystemSettings
Constructor Detail

AbstractObjectTypeHandler

public AbstractObjectTypeHandler()
Method Detail

getSystemSettings

public SystemSettings getSystemSettings()
Returns the System Settings that has been set to the TypeHandler.

Specified by:
getSystemSettings in interface TypeHandler
Returns:
The SystemSettings instance that has previously been set.

setSystemSettings

public void setSystemSettings(SystemSettings settings)
Sets the SystemSettings to this TypeHandler. This method is called when the TypeHandler is added to the ReflectorService.

Specified by:
setSystemSettings in interface TypeHandler
Parameters:
settings - The SystemSettings currently in use.

getNames

protected void getNames(Set names,
                        Object container)

packageNames

protected String[] packageNames(Set names)

getNames

protected void getNames(Set names,
                        Class clazz)

getMemberObject

public Object getMemberObject(Object container,
                              String memberName)
                       throws ReflectionException
Description copied from interface: TypeHandler
Returns the object that is assigned to the member of the provided container.

Specified by:
getMemberObject in interface TypeHandler
Parameters:
container - The container that is being queried.
memberName - The name of the member for which the value is requested.
Returns:
The object assigned to the member of the container.
Throws:
ReflectionException - if a member with the provided name does not exist, or if an exception is thrown while accessing the container.

setMemberObject

public void setMemberObject(Object container,
                            String member,
                            Object value)
                     throws ReflectionException
Description copied from interface: TypeHandler
Sets the member of a container to the provided value.

Specified by:
setMemberObject in interface TypeHandler
Parameters:
container - The container that is being queried.
member - The name of the member to have the value set to.
value - The value object to be assigned to the member of the container.
Throws:
ReflectionException - if a member with the provided name does not exist, or if an exception is thrown while accessing the container.

getMemberClass

public Class getMemberClass(Object container,
                            String memberName)
                     throws ReflectionException
Description copied from interface: TypeHandler
Returns the Class of the member.

The Class return is the type of the field or return type of the member and not the Class of the assigned object to that member.

Specified by:
getMemberClass in interface TypeHandler
Parameters:
container - The container that is being queried.
memberName - The member of the container, for which the Class is to be return.
Returns:
The Class of the member in the provided container.
Throws:
ReflectionException

isMemberSettable

public boolean isMemberSettable(Object container,
                                String memberName)
                         throws ReflectionException
Description copied from interface: TypeHandler
Returns true if the member is settable.

Specified by:
isMemberSettable in interface TypeHandler
Parameters:
container - The container of interest.
memberName - The name of the member in the provided container to be checked for if it is settable.
Returns:
true if the member can be set by calling setMemberObject().
Throws:
ReflectionException


Copyright © 2006-2012 OPS4J - Open Participation Software for Java. All Rights Reserved.