|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.softwareag.centrasite.appl.framework.utils.CollectionUtils
public final class CollectionUtils
Utility class providing convenient methods over Collections.
Method Summary | |
---|---|
static void |
applyChanges(java.util.List<? extends javax.xml.registry.infomodel.RegistryObject> registryObjects,
java.util.List<? extends RegistryBean> beans,
ChangeHandler changeHandler)
Compares the two List instances based on objects key and
determines the removed, created and updated objects. |
static java.lang.Class<RegistryBean> |
getAssociationTargetType(java.lang.reflect.Method getter,
Association associationAnnotation)
Determines the type of mapped to an association registry bean. |
static java.lang.Class<RegistryBean> |
getClassificationTargetType(java.lang.reflect.Method getter,
Classification classificationAnnotation)
Determines the type of mapped to a classification registry bean. |
static java.lang.Class<?> |
getSlotTargetType(java.lang.reflect.Method getter,
Slot slotAnnotation)
Determines the type of mapped to a slot property. |
static java.lang.Class<RegistryBean> |
getTargetType(java.lang.reflect.Method getter,
java.lang.Class<?> annotationTargetType)
If the getter method returns Collection returns the
annotation target type, otherwise returns the getter return type. |
static java.util.Collection<?> |
initCollection(java.lang.Class<?> collectionType)
Creates empty implementation for List , Collection , or Set . |
static boolean |
isCollection(java.lang.Class<?> type)
Determines if the given type is a Collection . |
static void |
setCollectionProperty(java.lang.Object pBean,
java.lang.reflect.Method pSetter,
java.lang.reflect.Method pGetter,
java.util.Collection<?> pValue)
Adds the passed collection values to the collection property specified with the getter and setter methods. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.util.Collection<?> initCollection(java.lang.Class<?> collectionType)
List
, Collection
, or Set
.
java.lang.IllegalArgumentException
- If the argument is not List
, Collection
or Set
.public static void applyChanges(java.util.List<? extends javax.xml.registry.infomodel.RegistryObject> registryObjects, java.util.List<? extends RegistryBean> beans, ChangeHandler changeHandler) throws javax.xml.registry.JAXRException, MappingException
List
instances based on objects key and
determines the removed, created and updated objects. For each of those
groups invokes the corresponding method of the ChangeHandler
instance passed as an argument
registryObjects
- The List
of existing registry objects.beans
- The List
of registry beans representing the registry objects.changeHandler
- Provides the logic for applying the changes.
javax.xml.registry.JAXRException
MappingException
public static void setCollectionProperty(java.lang.Object pBean, java.lang.reflect.Method pSetter, java.lang.reflect.Method pGetter, java.util.Collection<?> pValue)
pBean
- The bean on which the collection is being set.pSetter
- The collections setter. This is only used, if the collection
is currently null.pGetter
- The collections getter. This is used to retrieve the
collection from the bean. If the getter returns non-null, then
the value will be added to the collection.pValue
- The collection value to add.public static java.lang.Class<RegistryBean> getAssociationTargetType(java.lang.reflect.Method getter, Association associationAnnotation)
Collection
the mapped type
is determined by the Association.targetType()
attribute.
Otherwise this method returns the return type of the getter method.
getter
- The Method
representing the mapped property.associationAnnotation
- The Association
annotation specified by the user for
the property represented by the getter method.
public static java.lang.Class<RegistryBean> getClassificationTargetType(java.lang.reflect.Method getter, Classification classificationAnnotation)
Collection
the mapped type
is determined by the Classification.targetType()
attribute.
Otherwise this method returns the return type of the getter method.
getter
- The Method
representing the mapped property.classificationAnnotation
- The Classification
annotation specified by the user for
the property represented by the getter method.
public static java.lang.Class<?> getSlotTargetType(java.lang.reflect.Method getter, Slot slotAnnotation)
Collection
the mapped type
is determined by the Slot.targetType()
attribute.
Otherwise this method returns the return type of the getter method.
getter
- The Method
representing the mapped property.slotAnnotation
- The Slot
annotation specified by the user for
the property represented by the getter method.
public static java.lang.Class<RegistryBean> getTargetType(java.lang.reflect.Method getter, java.lang.Class<?> annotationTargetType)
Collection
returns the
annotation target type, otherwise returns the getter return type.
public static boolean isCollection(java.lang.Class<?> type)
Collection
. This means
instance of Collection
or its subclass.
type
-
true
if the given class is instance of Collection
or one of its subclasses. false
otherwise.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |