|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ca.commons.jndi.beans.MultiValuedAttribHandler
public class MultiValuedAttribHandler
A JNDI bean handler implementation to assist processing of
multi-valued JNDI attributes. This class handles a common case where
a multivalued JNDI attribute is to have all its
values placed into a Collection. For multivalued attributes
that have a more complicated mapping, the
JNDIBeanPropertyHandler interface must be implemented directly.
This class is designed to be used as a super class, with subclasses
overriding attrib2Property and property2Attrib
to convert each value as appropriate. This class provides implementations
of these methods that simply return the values unchanged, so it can be
used as is to aggregate attribute values into a Collection
without converting them.
This class does not accept any initialization properties, but its subclasses may do so.
| Field Summary |
|---|
| Fields inherited from interface com.ca.commons.jndi.beans.JNDIBeanPropertyHandler |
|---|
logger |
| Constructor Summary | |
|---|---|
MultiValuedAttribHandler()
|
|
| Method Summary | |
|---|---|
protected Object |
attrib2Property(Object attrValue)
Converts a single attribute value to a value to be included in the Collection result. |
List<?> |
getAttributeValues(Object value)
Converts elements of a Collection into a values of
a multivalued JNDI attribute. |
Object |
getPropertyValue(Attribute[] attr)
Places all values of a multivalued JNDI attribute into a Collection,
optionally performing a conversion on each individual action. |
void |
init(Properties props)
Provides a set of properties to initialize the handler. |
protected Object |
property2Attrib(Object propValue)
Converts a single property value to an attribute value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MultiValuedAttribHandler()
| Method Detail |
|---|
public void init(Properties props)
throws JNDIBeanStoreConfigException
JNDIBeanPropertyHandlerJNDIBeanStoreFactory
with the properties listed by its XML configuration data.
init in interface JNDIBeanPropertyHandlerprops - The properties to use for initialization.
JNDIBeanStoreConfigException - If any of the properties were
invalid in any way.
public Object getPropertyValue(Attribute[] attr)
throws NamingException
Collection,
optionally performing a conversion on each individual action.
Each value of the attribute is converted via the
attrib2Property(java.lang.Object) method before being
placed in the result Collection.
getPropertyValue in interface JNDIBeanPropertyHandlerattr - An array containing the multivalued attribute to convert.
This array should have a length of 1.
Collection containing all of the attribute's
values after conversion by attrib2Property.
NamingException - If the attribute's values could not be read.
JNDIBeanStoreException - If thrown by attrib2Property.
public List<?> getAttributeValues(Object value)
throws JNDIBeanStoreException
Collection into a values of
a multivalued JNDI attribute. The value parameter must
by a Collection. Each element in value
is converted via the property2Attrib(java.lang.Object)
method. The returned List will contain a single element,
a Collection containing all the converted values.
getAttributeValues in interface JNDIBeanPropertyHandlervalue - A Collection containing the values to convert.
JNDIBeanStoreException - If thrown by property2Attrib.
@Nullable
protected Object attrib2Property(@Nullable
Object attrValue)
throws JNDIBeanStoreException
Collection result. This is called by
getPropertyValue(javax.naming.directory.Attribute[])
for each value of the multivalued attribute.
The default implementation simply returns the same reference it
was passed.
attrValue - An attribute value.
JNDIBeanStoreException - If the value could not be converted.
@Nullable
protected Object property2Attrib(@Nullable
Object propValue)
throws JNDIBeanStoreException
getAttributeValues(java.lang.Object)
for each element of the input Collection.
The default implementation simply returns the same reference it
was passed.
propValue - A property value.
JNDIBeanStoreException - If the value could not be converted.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||