| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.morph.reflect.reflectors.BaseReflector
net.sf.morph.reflect.reflectors.MapReflector
public class MapReflector
Reflector for Maps that allows a map to be treated both as a container and as a bean.
| Field Summary | |
|---|---|
| static java.lang.String | DEFAULT_MAP_TREATMENTThe default treatment for Maps (which is to extract the values in the Map). | 
| static java.lang.String | EXTRACT_ENTRIESIndicates that the entrySetof the source map should be
 copied to the destination container object. | 
| static java.lang.String | EXTRACT_KEYSIndicates that the keySetof the source map should be
 copied to the destination container object. | 
| static java.lang.String | EXTRACT_VALUESIndicates that the valuesof the source map should be
 copied to the destination container object. | 
| static java.lang.String | IMPLICIT_PROPERTY_ENTRIESImplicit entriesproperty | 
| static java.lang.String | IMPLICIT_PROPERTY_KEYSImplicit keysproperty | 
| static java.lang.String | IMPLICIT_PROPERTY_VALUESImplicit valuesproperty | 
| protected static java.lang.String[] | MAP_TREATMENTSAll of the allowed map treatments. | 
| Fields inherited from class net.sf.morph.reflect.reflectors.BaseReflector | 
|---|
| log | 
| Fields inherited from interface net.sf.morph.reflect.BeanReflector | 
|---|
| IMPLICIT_PROPERTY_CLASS, IMPLICIT_PROPERTY_PROPERTY_NAMES, IMPLICIT_PROPERTY_THIS | 
| Constructor Summary | |
|---|---|
| MapReflector()Create a new MapReflector using the default map treatment. | |
| MapReflector(java.lang.String mapTreatment)Create a new MapReflector. | |
| Method Summary | |
|---|---|
| protected  boolean | addImpl(java.lang.Object container,
        java.lang.Object value)Implementation of GrowableContainer.add(Object). | 
| protected  java.lang.Class | getContainedTypeImpl(java.lang.Class clazz)Implementation of ContainerReflector.getContainedType(Class). | 
| protected  java.lang.Object | getImpl(java.lang.Object bean,
        java.lang.String propertyName)Implementation of BeanReflector.get(Object, String). | 
| protected  java.util.Iterator | getIteratorImpl(java.lang.Object container)Implementation of ContainerReflector.getIterator(Object). | 
| protected  java.util.Map | getMap(java.lang.Object container)Get the specified container as a Map. | 
|  java.lang.String | getMapTreatment()Get the map treatment in use. | 
| protected  java.lang.String[] | getPropertyNamesImpl(java.lang.Object bean)Implementation of BeanReflector.getPropertyNames(Object). | 
|  java.lang.Class[] | getReflectableClassesImpl()Implementation of Reflector.getReflectableClasses(). | 
| protected  int | getSizeImpl(java.lang.Object container)Implementation of SizableReflector.getSize(Object). | 
| protected  java.lang.Class | getTypeImpl(java.lang.Object bean,
            java.lang.String propertyName)Implementation of BeanReflector.getType(Object, String). | 
|  boolean | isExtractEntries()Learn whether this reflector extracts map entries. | 
|  boolean | isExtractKeys()Learn whether this reflector extracts map keys. | 
|  boolean | isExtractValues()Learn whether this reflector extracts map values. | 
| protected  boolean | isReadableImpl(java.lang.Object bean,
               java.lang.String propertyName)Implementation of BeanReflector.isReadable(Object, String). | 
| protected  boolean | isWriteableImpl(java.lang.Object bean,
                java.lang.String propertyName)Implementation of BeanReflector.isWriteable(Object, String). | 
| protected  java.lang.Object | newInstanceImpl(java.lang.Class interfaceClass,
                java.lang.Object parameters)Implementation of InstantiatingReflector.newInstance(Class, Object). | 
| protected  void | setImpl(java.lang.Object bean,
        java.lang.String propertyName,
        java.lang.Object value)Implementation of BeanReflector.set(Object, String, Object). | 
|  void | setMapTreatment(java.lang.String mapTreatment)Sets how maps are treated by this reflector. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Methods inherited from interface net.sf.morph.reflect.InstantiatingReflector | 
|---|
| newInstance | 
| Methods inherited from interface net.sf.morph.reflect.GrowableContainerReflector | 
|---|
| add | 
| Methods inherited from interface net.sf.morph.reflect.ContainerReflector | 
|---|
| getContainedType, getIterator | 
| Methods inherited from interface net.sf.morph.reflect.BeanReflector | 
|---|
| get, getPropertyNames, getType, isReadable, isWriteable, set | 
| Field Detail | 
|---|
public static final java.lang.String IMPLICIT_PROPERTY_ENTRIES
entries property
public static final java.lang.String IMPLICIT_PROPERTY_KEYS
keys property
public static final java.lang.String IMPLICIT_PROPERTY_VALUES
values property
public static final java.lang.String EXTRACT_VALUES
values of the source map should be
 copied to the destination container object.
Map.values(), 
Constant Field Valuespublic static final java.lang.String EXTRACT_ENTRIES
entrySet of the source map should be
 copied to the destination container object. For example, if the
 destination container object is a List, then each Map.Entry in the source
 map will be copied to the destination List
Map.entrySet(), 
Constant Field Valuespublic static final java.lang.String EXTRACT_KEYS
keySet of the source map should be
 copied to the destination container object. For example, if the
 destination container object is a List, then each key in the source map
 will be copied to the destination List.
Map.keySet(), 
Constant Field Valuespublic static final java.lang.String DEFAULT_MAP_TREATMENT
ContainerCopier#EXTRACT_VALUES, 
Constant Field Valuesprotected static java.lang.String[] MAP_TREATMENTS
| Constructor Detail | 
|---|
public MapReflector()
public MapReflector(java.lang.String mapTreatment)
mapTreatment - to use| Method Detail | 
|---|
protected java.util.Map getMap(java.lang.Object container)
container - to get
protected int getSizeImpl(java.lang.Object container)
                   throws java.lang.Exception
SizableReflector.getSize(Object).
getSizeImpl in class BaseReflectorjava.lang.Exception
protected java.lang.Class getContainedTypeImpl(java.lang.Class clazz)
                                        throws java.lang.Exception
ContainerReflector.getContainedType(Class).
getContainedTypeImpl in class BaseReflectorjava.lang.Exceptionpublic java.lang.Class[] getReflectableClassesImpl()
Reflector.getReflectableClasses().
getReflectableClassesImpl in class BaseReflector
protected java.lang.Object newInstanceImpl(java.lang.Class interfaceClass,
                                           java.lang.Object parameters)
                                    throws java.lang.Exception
InstantiatingReflector.newInstance(Class, Object).
 Default implementation returns a new instance of the given class by
 calling Class#newInstance()).
newInstanceImpl in class BaseReflectorjava.lang.Exception
protected boolean addImpl(java.lang.Object container,
                          java.lang.Object value)
                   throws java.lang.Exception
GrowableContainer.add(Object).
addImpl in class BaseReflectorjava.lang.Exception
protected java.util.Iterator getIteratorImpl(java.lang.Object container)
                                      throws java.lang.Exception
ContainerReflector.getIterator(Object).
getIteratorImpl in class BaseReflectorjava.lang.Exception
protected java.lang.String[] getPropertyNamesImpl(java.lang.Object bean)
                                           throws java.lang.Exception
BeanReflector.getPropertyNames(Object).
 Implementation automatically provided for
 IndexedContainerReflectors.  For other reflectors, throws an
 UnsupportedOperationException.
getPropertyNamesImpl in class BaseReflectorjava.lang.Exception
protected java.lang.Class getTypeImpl(java.lang.Object bean,
                                      java.lang.String propertyName)
                               throws java.lang.Exception
BeanReflector.getType(Object, String).
 Default implementation provided. For IndexedContainerReflectors,
 returns the type by calling
 ContainerReflector.getContainedType(Class).
 For other reflectors, checks the type of the property by calling
 BaseReflector.get(Object, String).
getTypeImpl in class BaseReflectorjava.lang.Exception
protected boolean isReadableImpl(java.lang.Object bean,
                                 java.lang.String propertyName)
                          throws java.lang.Exception
BeanReflector.isReadable(Object, String).
 Default implementation assumes that all properties of the bean specified
 by BeanReflector.getPropertyNames(Object) are readable.
isReadableImpl in class BaseReflectorjava.lang.Exception
protected boolean isWriteableImpl(java.lang.Object bean,
                                  java.lang.String propertyName)
                           throws java.lang.Exception
BeanReflector.isWriteable(Object, String).
 Default implementation assumes that all readable properties are also
 writeable. One exception to this is when this reflector is an
 IndexedContainerReflector but not a MutableIndexedContainerReflector, in
 which case no properties are considered writeable.
isWriteableImpl in class BaseReflectorjava.lang.Exception
protected java.lang.Object getImpl(java.lang.Object bean,
                                   java.lang.String propertyName)
                            throws java.lang.Exception
BeanReflector.get(Object, String).
 Implementation automatically provided for
 IndexedContainerReflectors.  For other reflectors, throws an
 UnsupportedOperationException.
getImpl in class BaseReflectorjava.lang.Exception
protected void setImpl(java.lang.Object bean,
                       java.lang.String propertyName,
                       java.lang.Object value)
                throws java.lang.Exception
BeanReflector.set(Object, String, Object).
 Implementation automatically provided for
 MutableIndexedContainerReflectors.  For other reflectors, throws an
 UnsupportedOperationException.
setImpl in class BaseReflectorjava.lang.Exceptionpublic java.lang.String getMapTreatment()
public void setMapTreatment(java.lang.String mapTreatment)
                     throws ReflectionException
mapTreatment - how maps are treated by this reflector
ReflectionException - if an invalid map treatment is specifiedpublic boolean isExtractEntries()
public boolean isExtractKeys()
public boolean isExtractValues()
| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||