org.ops4j.pax.reflector.typehandlers
Class ObjectTypeHandler

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

public final class ObjectTypeHandler
extends AbstractObjectTypeHandler


Field Summary
 
Fields inherited from class org.ops4j.pax.reflector.typehandlers.AbstractObjectTypeHandler
m_SystemSettings
 
Constructor Summary
ObjectTypeHandler()
           
 
Method Summary
 boolean canHandle(Object container)
          Query if this TypeHandler can deal with the container argument.
 String[] getMemberNames(Object container)
          Returns the names of all the accessible members in the container.
 String getSeparator()
          Returns the separator string between container part and the name part.
 
Methods inherited from class org.ops4j.pax.reflector.typehandlers.AbstractObjectTypeHandler
getMemberClass, getMemberObject, getNames, getNames, getSystemSettings, isMemberSettable, packageNames, setMemberObject, setSystemSettings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectTypeHandler

public ObjectTypeHandler()
Method Detail

canHandle

public boolean canHandle(Object container)
Query if this TypeHandler can deal with the container argument.

If this TypeHandler is not able to handle the provided container the ReflectorProvider implementation must continue to query the lower priority TypeHandlers. It is important that there is a TypeHandler that can handle "everything else", if this query falls through all the way.

The implementation in this class always return true as this is a TypeHandler intended for the default/unhandled case to be populate to the ReflectionProvider first.

Parameters:
container - The container that is being tested.
Returns:
true if this TypeHandler is capable of handling the provided container, false otherwise.

getMemberNames

public String[] getMemberNames(Object container)
Returns the names of all the accessible members in the container.

The names returned are in such format that they can be appended to the container, after a getSeparator() string.

This TypeHandler uses the Reflection API and queries for all public fields and public getter methods. If it finds public fields that starts with "m_" then those two characters are stripped from the name.

Parameters:
container - the container to query for the names.
Returns:
The names of the members in the container object.

getSeparator

public String getSeparator()
Returns the separator string between container part and the name part.

This implementation returns a dot.

Returns:
the String used to separate the container from the name. Typically this is a dot '.', but can be others including an empty string.


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