|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ops4j.pax.reflector.typehandlers.CollectionTypeHandler
public final class CollectionTypeHandler
Field Summary | |
---|---|
protected SystemSettings |
m_SystemSettings
|
Constructor Summary | |
---|---|
CollectionTypeHandler()
|
Method Summary | |
---|---|
boolean |
canHandle(Object container)
Query if this TypeHandler can deal with the container argument. |
Class |
getMemberClass(Object container,
String memberName)
Returns the Class of the member. |
String[] |
getMemberNames(Object object)
Returns the names of all the accessible members in the container. |
Object |
getMemberObject(Object container,
String membername)
Returns the object that is assigned to the member of the provided container. |
String |
getSeparator()
Returns the separator string between container part and the name part. |
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. |
void |
setMemberObject(Object container,
String membername,
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 |
Field Detail |
---|
protected SystemSettings m_SystemSettings
Constructor Detail |
---|
public CollectionTypeHandler()
Method Detail |
---|
public SystemSettings getSystemSettings()
getSystemSettings
in interface TypeHandler
public void setSystemSettings(SystemSettings settings)
setSystemSettings
in interface TypeHandler
settings
- The SystemSettings currently in use.public boolean canHandle(Object container)
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 does;
to determine if the
return container instanceof Collection;
container
can be handled by this TypeHandler.
canHandle
in interface TypeHandler
container
- The container that is being tested.
public String[] getMemberNames(Object object)
The names returned are in such format that they can be appended to the container, after a getSeparator() string.
This TypeHandler returns an sequence of numbers from 0 to size of collection minus 1.
getMemberNames
in interface TypeHandler
object
- the container to query for the names.
public Object getMemberObject(Object container, String membername) throws ReflectionException
TypeHandler
getMemberObject
in interface TypeHandler
container
- The container that is being queried.membername
- The name of the member for which the value is requested.
ReflectionException
- if a member with the provided name does not exist, or if
an exception is thrown while accessing the container.public void setMemberObject(Object container, String membername, Object value) throws ReflectionException
TypeHandler
setMemberObject
in interface TypeHandler
container
- The container that is being queried.membername
- The name of the member to have the value set to.value
- The value object to be assigned to the member of the container.
ReflectionException
- if a member with the provided name does not exist, or if
an exception is thrown while accessing the container.public Class getMemberClass(Object container, String memberName) throws ReflectionException
TypeHandler
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.
getMemberClass
in interface TypeHandler
container
- The container that is being queried.memberName
- The member of the container, for which the Class is to be return.
ReflectionException
public boolean isMemberSettable(Object container, String membername) throws ReflectionException
TypeHandler
isMemberSettable
in interface TypeHandler
container
- The container of interest.membername
- The name of the member in the provided container to be checked for if it is settable.
ReflectionException
public String getSeparator()
This implementation returns an empty String.
getSeparator
in interface TypeHandler
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |