@ThreadSafe @Immutable public class PodamFactoryImpl extends Object implements PodamFactory
| Modifier and Type | Field and Description |
|---|---|
private PodamFactory |
externalFactory
External factory to delegate production this factory cannot handle
|
private static org.slf4j.Logger |
LOG
Application logger
|
private static String |
MAP_CREATION_EXCEPTION_STR |
private Map<Class<?>,Object> |
memoizationTable
A map to keep one object for each class.
|
private static Type[] |
NO_TYPES |
private static String |
RAWTYPES_STR |
private static String |
RESOLVING_COLLECTION_EXCEPTION_STR |
private DataProviderStrategy |
strategy
The strategy to use to fill data.
|
private static String |
THE_ANNOTATION_VALUE_STR |
private static String |
UNCHECKED_STR |
| Constructor and Description |
|---|
PodamFactoryImpl()
Default constructor.
|
PodamFactoryImpl(DataProviderStrategy strategy)
Constructor with non-default strategy
|
PodamFactoryImpl(PodamFactory externalFactory)
Constructor with non-default external factory
|
PodamFactoryImpl(PodamFactory externalFactory,
DataProviderStrategy strategy)
Full constructor.
|
| Modifier and Type | Method and Description |
|---|---|
private PodamStrategyValue |
containsAttributeStrategyAnnotation(List<Annotation> annotations)
It returns a
PodamStrategyValue if one was specified, or
null otherwise. |
private Object |
createNewInstanceForClassWithoutConstructors(Class<?> pojoClass,
Map<Class<?>,Integer> pojos,
Class<?> clazz,
Type... genericTypeArgs)
It attempts to create an instance of the given class
|
private void |
fillCollection(Class<?> pojoClass,
Map<Class<?>,Integer> pojos,
List<Annotation> annotations,
Collection<? super Object> collection,
Class<?> collectionElementType,
Type... genericTypeArgs)
It fills a collection with the required number of elements of the
required type.
|
private void |
fillCollection(Collection<? super Object> collection,
Map<Class<?>,Integer> pojos,
Type... genericTypeArgs)
It fills a collection with the required number of elements of the
required type.
|
private void |
fillMap(Map<? super Object,? super Object> map,
Map<Class<?>,Integer> pojos,
Type... genericTypeArgs)
It fills a Map with the required number of elements of the required type.
|
private void |
fillMap(MapArguments mapArguments)
It fills a Map with the required number of elements of the required type.
|
private Type[] |
fillTypeArgMap(Map<String,Type> typeArgsMap,
Class<?> pojoClass,
Type[] genericTypeArgs)
Fills type agruments map
|
private Boolean |
getBooleanValueForAnnotation(List<Annotation> annotations)
It returns the boolean value indicated in the annotation.
|
private Byte |
getByteValueWithinRange(List<Annotation> annotations,
AttributeMetadata attributeMetadata)
It returns a random byte if the attribute was annotated with
PodamByteValue or null otherwise |
private Character |
getCharacterValueWithinRange(List<Annotation> annotations,
AttributeMetadata attributeMetadata)
It creates and returns a random
Character value |
private <T> T |
getDefaultFieldValue(Class<?> pojoClass,
String attributeName)
It returns an default value for a
Field matching the attribute
name or null if a field was not found. |
private Double |
getDoubleValueWithinRange(List<Annotation> annotations,
AttributeMetadata attributeMetadata)
It creates and returns a random
Double value |
private Field |
getField(Class<?> pojoClass,
String attributeName)
It returns a
Field matching the attribute name or null if a field
was not found. |
private Float |
getFloatValueWithinRange(List<Annotation> annotations,
AttributeMetadata attributeMetadata)
Returns either a customised float value if a
PodamFloatValue
annotation was provided or a random float if this was not the case |
private Integer |
getIntegerValueWithinRange(List<Annotation> annotations,
AttributeMetadata attributeMetadata)
Returns either a customised int value if a
PodamIntValue
annotation was provided or a random integer if this was not the case |
private Long |
getLongValueWithinRange(List<Annotation> annotations,
AttributeMetadata attributeMetadata)
Returns either a customised long value if a
PodamLongValue
annotation was provided or a random long if this was not the case |
private Object |
getMapKeyOrElementValue(MapKeyOrElementsArguments keyOrElementsArguments)
It fills a Map key or value with the appropriate value, considering
attribute-level customisation.
|
private Object[] |
getParameterValuesForConstructor(Constructor<?> constructor,
Class<?> pojoClass,
Map<Class<?>,Integer> pojos,
Type... genericTypeArgs)
Given a constructor it manufactures and returns the parameter values
required to invoke it
|
private Short |
getShortValueWithinRange(List<Annotation> annotations,
AttributeMetadata attributeMetadata)
It returns a random short if the attribute was annotated with
PodamShortValue or null otherwise |
DataProviderStrategy |
getStrategy()
It returns the strategy for this factory.
|
private <T> T |
instantiatePojo(Class<T> pojoClass,
Map<Class<?>,Integer> pojos,
Type... genericTypeArgs)
It creates and returns an instance of the given class if at least one of
its constructors has been annotated with
PodamConstructor |
private boolean |
isWrapper(Class<?> candidateWrapperClass)
It returns
true if this class is a wrapper class, false
otherwise |
private Object |
manufactureAttributeValue(Class<?> pojoClass,
Map<Class<?>,Integer> pojos,
Class<?> attributeType,
List<Annotation> annotations,
String attributeName,
Map<String,Type> typeArgsMap,
Type... genericTypeArgs)
It manufactures and returns the value for a POJO attribute.
|
private Object |
manufactureAttributeValue(Class<?> pojoClass,
Map<Class<?>,Integer> pojos,
Class<?> attributeType,
List<Annotation> annotations,
String attributeName,
Type... genericTypeArgs)
It manufactures and returns the value for a POJO attribute.
|
<T> T |
manufacturePojo(Class<T> pojoClass)
Generic method which returns an instance of the given class filled with
dummy values, using the default data provider strategy.
|
<T> T |
manufacturePojo(Class<T> pojoClass,
Type... genericTypeArgs)
Generic method which returns an instance of the given class filled with
dummy values, using the default data provider strategy.
|
private <T> T |
manufacturePojoInternal(Class<T> pojoClass,
Map<Class<?>,Integer> pojos,
Type... genericTypeArgs)
Generic method which returns an instance of the given class filled with
values dictated by the strategy
|
private Type[] |
mergeTypeArrays(Type[] original,
Type[] extra)
Utility method to merge two arrays
|
private Object |
resolveArrayElementValue(Class<?> attributeType,
Map<Class<?>,Integer> pojos,
List<Annotation> annotations,
Class<?> pojoClass,
String attributeName,
Map<String,Type> typeArgsMap)
It returns an Array with the first element set
|
private Collection<? super Object> |
resolveCollectionType(Class<?> collectionType)
Given a collection type it returns an instance
|
private Collection<? super Object> |
resolveCollectionValueWhenCollectionIsPojoAttribute(Class<?> pojoClass,
Map<Class<?>,Integer> pojos,
Class<?> collectionType,
String attributeName,
List<Annotation> annotations,
Map<String,Type> typeArgsMap,
Type... genericTypeArgs)
It returns a collection of some sort with some data in it.
|
private Class<?> |
resolveGenericParameter(Type paramType,
Map<String,Type> typeArgsMap,
AtomicReference<Type[]> methodGenericTypeArgs)
It resolves generic parameter type
|
private Map<? super Object,? super Object> |
resolveMapType(Class<?> mapType)
It manufactures and returns a default instance for each map type
|
private Map<? super Object,? super Object> |
resolveMapValueWhenMapIsPojoAttribute(Class<?> pojoClass,
Map<Class<?>,Integer> pojos,
Class<?> attributeType,
String attributeName,
List<Annotation> annotations,
Map<String,Type> typeArgsMap,
Type... genericTypeArgs)
It manufactures and returns a Map with at least one element in it
|
private Object |
resolvePrimitiveValue(Class<?> primitiveClass,
List<Annotation> annotations,
AttributeMetadata attributeMetadata)
It resolves and returns the primitive value depending on the type
|
private String |
resolveStringValue(List<Annotation> annotations,
AttributeMetadata attributeMetadata)
It creates and returns a String value, eventually customised by
annotations
|
private Object |
resolveWrapperValue(Class<?> candidateWrapperClass,
List<Annotation> annotations,
AttributeMetadata attributeMetadata)
It attempts to resolve the given class as a wrapper class and if this is
the case it assigns a random value
|
private List<Annotation> |
retrieveFieldAnnotations(Class<?> clazz,
Method setter)
Given the original class and the setter method, it returns all
annotations for the field or an empty collection if no custom annotations
were found on the field
|
private Object |
returnAttributeDataStrategyValue(Class<?> attributeType,
AttributeStrategy<?> attributeStrategy)
It retrieves the value for the
PodamStrategyValue annotation with
which the attribute was annotated |
private static final String RESOLVING_COLLECTION_EXCEPTION_STR
private static final String MAP_CREATION_EXCEPTION_STR
private static final String RAWTYPES_STR
private static final String UNCHECKED_STR
private static final String THE_ANNOTATION_VALUE_STR
private static final Type[] NO_TYPES
private static final org.slf4j.Logger LOG
private final PodamFactory externalFactory
The default is LoggingExternalFactory.
private final DataProviderStrategy strategy
The default is RandomDataProviderStrategy.
public PodamFactoryImpl()
public PodamFactoryImpl(DataProviderStrategy strategy)
strategy - The strategy to use to fill datapublic PodamFactoryImpl(PodamFactory externalFactory)
externalFactory - External factory to delegate production this factory cannot
handlepublic PodamFactoryImpl(PodamFactory externalFactory, DataProviderStrategy strategy)
externalFactory - External factory to delegate production this factory cannot
handlestrategy - The strategy to use to fill datapublic <T> T manufacturePojo(Class<T> pojoClass)
This method uses RandomDataProviderStrategy as the default
implementation.
manufacturePojo in interface PodamFactorypojoClass - The name of the class for which an instance filled with values
is requiredpublic <T> T manufacturePojo(Class<T> pojoClass, Type... genericTypeArgs)
This method uses RandomDataProviderStrategy as the default
implementation.
manufacturePojo in interface PodamFactoryT - The type for which a filled instance is requiredpojoClass - The name of the class for which an instance filled with values
is requiredgenericTypeArgs - The generic Type arguments for a generic class instancepublic DataProviderStrategy getStrategy()
getStrategy in interface PodamFactoryprivate Type[] fillTypeArgMap(Map<String,Type> typeArgsMap, Class<?> pojoClass, Type[] genericTypeArgs)
This method places required and provided types for object creation into a map, which will be used for type mapping.
typeArgsMap - a map to fillpojoClass - Typed classgenericTypeArgs - Type arguments provided for a generics object by callerIllegalStateException - If number of typed parameters doesn't match number of
provided generic typesprivate Object createNewInstanceForClassWithoutConstructors(Class<?> pojoClass, Map<Class<?>,Integer> pojos, Class<?> clazz, Type... genericTypeArgs) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException
This method attempts to create an instance of the given argument for classes without setters. These may be either immutable classes (e.g. with final attributes and no setters) or Java classes (e.g. belonging to the java / javax namespace). In case the class does not provide a public, no-arg constructor (e.g. Calendar), this method attempts to find a , no-args, factory method (e.g. getInstance()) and it invokes it
pojoClass - The name of the class for which an instance filled with values
is requiredpojos - Set of manufactured pojos' typesclazz - The class for which a new instance is requiredgenericTypeArgs - The generic type arguments for the current generic class
instanceIllegalArgumentException - If an illegal argument was passed to the constructorInstantiationException - If an exception occurred during instantiationIllegalAccessException - If security was violated while creating the objectInvocationTargetException - If an exception occurred while invoking the constructor or
factory methodClassNotFoundException - If it was not possible to create a class from a stringprivate Class<?> resolveGenericParameter(Type paramType, Map<String,Type> typeArgsMap, AtomicReference<Type[]> methodGenericTypeArgs)
paramType - The generic parameter typetypeArgsMap - A map of resolved typesmethodGenericTypeArgs - Return value posible generic types of the generic parameter
typeprivate Object resolvePrimitiveValue(Class<?> primitiveClass, List<Annotation> annotations, AttributeMetadata attributeMetadata)
primitiveClass - The primitive type classannotations - The annotations to consider for this attributeattributeMetadata - IllegalArgumentException - If a specific value was set in an annotation but it was not
possible to convert such value in the desired typeprivate Boolean getBooleanValueForAnnotation(List<Annotation> annotations)
annotations - The collection of annotations for the annotated attributeprivate Byte getByteValueWithinRange(List<Annotation> annotations, AttributeMetadata attributeMetadata)
PodamByteValue or null otherwiseannotations - The list of annotations for this attributeattributeMetadata - The attribute's metadata, if any, used for customisationIllegalArgumentException - If the PodamByteValue.numValue() value has been set
and it is not convertible to a byte typeprivate Short getShortValueWithinRange(List<Annotation> annotations, AttributeMetadata attributeMetadata)
PodamShortValue or null otherwiseannotations - The annotations with which the attribute was annotatedattributeMetadata - The attribute's metadata, if any, used for customisationPodamShortValue or null otherwiseIllegalArgumentException - If PodamShortValue.numValue() was set and its value
could not be converted to a Short typeprivate Character getCharacterValueWithinRange(List<Annotation> annotations, AttributeMetadata attributeMetadata)
Character valueannotations - The list of annotations which might customise the return valueattributeMetadata - The attribute's metadata, if any, used for customisationCharacter valueprivate Integer getIntegerValueWithinRange(List<Annotation> annotations, AttributeMetadata attributeMetadata)
PodamIntValue
annotation was provided or a random integer if this was not the caseannotations - The list of annotations for the int attributeattributeMetadata - The attribute's metadata, if any, used for customisationPodamIntValue
annotation was provided or a random integer if this was not the
caseIllegalArgumentException - If it was not possible to convert the
PodamIntValue.numValue() to an Integerprivate Float getFloatValueWithinRange(List<Annotation> annotations, AttributeMetadata attributeMetadata)
PodamFloatValue
annotation was provided or a random float if this was not the caseannotations - The list of annotations for the int attributeattributeMetadata - The attribute's metadata, if any, used for customisationPodamFloatValue
annotation was provided or a random float if this was not the
caseIllegalArgumentException - If PodamFloatValue.numValue() contained a value not
convertible to a Float typeprivate Double getDoubleValueWithinRange(List<Annotation> annotations, AttributeMetadata attributeMetadata)
Double valueannotations - The list of annotations which might customise the return valueattributeMetadata - The attribute's metadata, if any, used for customisation *Double valueprivate Long getLongValueWithinRange(List<Annotation> annotations, AttributeMetadata attributeMetadata)
PodamLongValue
annotation was provided or a random long if this was not the caseannotations - The list of annotations for the int attributeattributeMetadata - The attribute's metadata, if any, used for customisationPodamLongValue
annotation was provided or a random long if this was not the caseIllegalArgumentException - If it was not possible to convert
PodamLongValue.numValue() to a Longprivate Object resolveWrapperValue(Class<?> candidateWrapperClass, List<Annotation> annotations, AttributeMetadata attributeMetadata)
candidateWrapperClass - The class which might be a wrapper classattributeMetadata - The attribute's metadata, if any, used for customisationnull if this is not a wrapper class, otherwise an Object
with the value for the wrapper classprivate <T> T instantiatePojo(Class<T> pojoClass, Map<Class<?>,Integer> pojos, Type... genericTypeArgs) throws SecurityException
PodamConstructorT - The type of the instance to returnpojoClass - The class of which an instance is requiredpojos - How many instances of the same class have been created so fargenericTypeArgs - The generic type arguments for the current generic class
instancePodamConstructorIllegalArgumentException - If an illegal argument was passed to the constructorInstantiationException - If an exception occurred during instantiationIllegalAccessException - If security was violated while creating the objectInvocationTargetException - If an exception occurred while invoking the constructor or
factory methodClassNotFoundException - If it was not possible to create a class from a stringSecurityExceptionprivate <T> T manufacturePojoInternal(Class<T> pojoClass, Map<Class<?>,Integer> pojos, Type... genericTypeArgs) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException
T - The type for which a filled instance is requiredpojoClass - The name of the class for which an instance filled with values
is requiredpojos - How many times pojoClass has been found. This will be
used for reentrant objectsgenericTypeArgs - The generic type arguments for the current generic class
instanceClassNotFoundExceptionInvocationTargetExceptionIllegalAccessExceptionInstantiationExceptionPodamMockeryException - if a problem occurred while creating a POJO instance or while
setting its stateprivate Object manufactureAttributeValue(Class<?> pojoClass, Map<Class<?>,Integer> pojos, Class<?> attributeType, List<Annotation> annotations, String attributeName, Type... genericTypeArgs) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException
pojoClass - The POJO class being filled with valuespojos - Set of manufactured pojos' typesattributeType - The type of the attribute for which a value is being
manufacturedannotations - The annotations for the attribute being consideredattributeName - The attribute namegenericTypeArgs - The generic type arguments for the current generic class
instanceInstantiationException - If an exception occurred during instantiationIllegalAccessException - If security was violated while creating the objectInvocationTargetException - If an exception occurred while invoking the constructor or
factory methodClassNotFoundException - If it was not possible to create a class from a stringIllegalArgumentException - private Object manufactureAttributeValue(Class<?> pojoClass, Map<Class<?>,Integer> pojos, Class<?> attributeType, List<Annotation> annotations, String attributeName, Map<String,Type> typeArgsMap, Type... genericTypeArgs) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException
pojoClass - The POJO class being filled with valuespojos - Set of manufactured pojos' typesattributeType - The type of the attribute for which a value is being
manufacturedannotations - The annotations for the attribute being consideredattributeName - The attribute nametypeArgsMap - a map relating the generic class arguments ("genericTypeArgs - The generic type arguments for the current generic class
instanceInstantiationException - If an exception occurred during instantiationIllegalAccessException - If security was violated while creating the objectInvocationTargetException - If an exception occurred while invoking the constructor or
factory methodClassNotFoundException - If it was not possible to create a class from a stringIllegalArgumentException - private String resolveStringValue(List<Annotation> annotations, AttributeMetadata attributeMetadata) throws InstantiationException, IllegalAccessException
annotations - The list of annotations used to customise the String value, if
anyattributeMetadata - IllegalAccessException - If an exception occurred while creating an instance of the
strategyInstantiationException - If an exception occurred while creating an instance of the
strategyIllegalArgumentException - If PodamStrategyValue was specified but the type was
not correct for the attribute being setprivate <T> T getDefaultFieldValue(Class<?> pojoClass, String attributeName)
Field matching the attribute
name or null if a field was not found.pojoClass - The class supposed to contain the fieldattributeName - The field nameField matching the attribute name or
null if a field was not found.private Field getField(Class<?> pojoClass, String attributeName)
Field matching the attribute name or null if a field
was not found.pojoClass - The class supposed to contain the fieldattributeName - The field nameField matching the attribute name or null if a field
was not found.private PodamStrategyValue containsAttributeStrategyAnnotation(List<Annotation> annotations)
PodamStrategyValue if one was specified, or
null otherwise.annotations - The list of annotationstrue if the list of annotations contains at least one
PodamStrategyValue annotation.private boolean isWrapper(Class<?> candidateWrapperClass)
true if this class is a wrapper class, false
otherwisecandidateWrapperClass - The class to checktrue if this class is a wrapper class, false
otherwiseprivate List<Annotation> retrieveFieldAnnotations(Class<?> clazz, Method setter)
clazz - The class containing the annotated attributesetter - The setter methodNoSuchFieldException - If the field could not be foundSecurityException - if a security exception occurredprivate Collection<? super Object> resolveCollectionValueWhenCollectionIsPojoAttribute(Class<?> pojoClass, Map<Class<?>,Integer> pojos, Class<?> collectionType, String attributeName, List<Annotation> annotations, Map<String,Type> typeArgsMap, Type... genericTypeArgs)
pojoClass - The POJO being analysedpojos - Set of manufactured pojos' typescollectionType - The type of the attribute being evaluatedannotations - The set of annotations for the annotated attribute. It might
be emptyattributeName - The name of the field being settypeArgsMap - a map relating the generic class arguments ("genericTypeArgs - The generic type arguments for the current generic class
instancePodamMockeryException - An exception occurred while resolving the collectionIllegalArgumentException - If the field name is null or emptyprivate void fillCollection(Collection<? super Object> collection, Map<Class<?>,Integer> pojos, Type... genericTypeArgs) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException
This method has a so-called side effect. It updates the collection passed as argument.
collection - The Collection to be filledpojos - Set of manufactured pojos' typesgenericTypeArgs - The generic type arguments for the current generic class
instanceInstantiationException - If an exception occurred during instantiationIllegalAccessException - If security was violated while creating the objectInvocationTargetException - If an exception occurred while invoking the constructor or
factory methodClassNotFoundException - If it was not possible to create a class from a stringprivate void fillCollection(Class<?> pojoClass, Map<Class<?>,Integer> pojos, List<Annotation> annotations, Collection<? super Object> collection, Class<?> collectionElementType, Type... genericTypeArgs) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException
This method has a so-called side effect. It updates the collection passed as argument.
pojoClass - The POJO where the collection attribute is definedpojos - Set of manufactured pojos' typesannotations - The annotations for this attributecollection - The Collection to be filledcollectionElementType - The type of the collection elementgenericTypeArgs - The generic type arguments for the current generic class
instanceInstantiationException - If an exception occurred during instantiationIllegalAccessException - If security was violated while creating the objectInvocationTargetException - If an exception occurred while invoking the constructor or
factory methodClassNotFoundException - If it was not possible to create a class from a stringprivate Map<? super Object,? super Object> resolveMapValueWhenMapIsPojoAttribute(Class<?> pojoClass, Map<Class<?>,Integer> pojos, Class<?> attributeType, String attributeName, List<Annotation> annotations, Map<String,Type> typeArgsMap, Type... genericTypeArgs)
pojoClass - The POJO being initialisedpojos - Set of manufactured pojos' typesattributeType - The type of the POJO map attributeattributeName - The POJO attribute nameannotations - The annotations specified for this attributetypeArgsMap - a map relating the generic class arguments ("genericTypeArgs - The generic type arguments for the current generic class
instanceIllegalArgumentException - PodamMockeryException - If an error occurred while creating the Map objectprivate void fillMap(Map<? super Object,? super Object> map, Map<Class<?>,Integer> pojos, Type... genericTypeArgs) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException
This method has a so-called side-effect. It updates the Map given as argument.
pojoClass - The POJO being initialisedpojos - Set of manufactured pojos' typesgenericTypeArgs - The generic type arguments for the current generic class
instanceInstantiationException - If an exception occurred during instantiationIllegalAccessException - If security was violated while creating the objectInvocationTargetException - If an exception occurred while invoking the constructor or
factory methodClassNotFoundException - If it was not possible to create a class from a stringprivate void fillMap(MapArguments mapArguments) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException
This method has a so-called side-effect. It updates the Map given as argument.
mapArguments - The arguments POJOInstantiationException - If an exception occurred during instantiationIllegalAccessException - If security was violated while creating the objectInvocationTargetException - If an exception occurred while invoking the constructor or
factory methodClassNotFoundException - If it was not possible to create a class from a stringprivate Object getMapKeyOrElementValue(MapKeyOrElementsArguments keyOrElementsArguments) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException
keyOrElementsArguments - The arguments POJOInstantiationException - If an exception occurred during instantiationIllegalAccessException - If security was violated while creating the objectInvocationTargetException - If an exception occurred while invoking the constructor or
factory methodIllegalArgumentException - ClassNotFoundExceptionprivate Object resolveArrayElementValue(Class<?> attributeType, Map<Class<?>,Integer> pojos, List<Annotation> annotations, Class<?> pojoClass, String attributeName, Map<String,Type> typeArgsMap) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException
attributeType - The array typepojos - Set of manufactured pojos' typesannotations - The annotations to be consideredpojoClass - attributeName - typeArgsMap - a map relating the generic class arguments ("IllegalArgumentException - If an illegal argument was passed to the constructorInstantiationException - If an exception occurred during instantiationIllegalAccessException - If security was violated while creating the objectInvocationTargetException - If an exception occurred while invoking the constructor or
factory methodClassNotFoundException - If it was not possible to create a class from a stringprivate Collection<? super Object> resolveCollectionType(Class<?> collectionType)
collectionType - The collection type *private Map<? super Object,? super Object> resolveMapType(Class<?> mapType)
The default implementation for a ConcurrentMap is
ConcurrentHashMap
The default implementation for a SortedMap is a TreeMap
The default Map is none of the above was recognised is a HashMap
mapType - The attribute type implementing Mapprivate Object[] getParameterValuesForConstructor(Constructor<?> constructor, Class<?> pojoClass, Map<Class<?>,Integer> pojos, Type... genericTypeArgs) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException
constructor - The constructor for which parameter values are requiredpojoClass - The POJO class containing the constructorpojos - Set of manufactured pojos' typesgenericTypeArgs - The generic type arguments for the current generic class
instanceIllegalArgumentException - If an illegal argument was passed to the constructorInstantiationException - If an exception occurred during instantiationIllegalAccessException - If security was violated while creating the objectInvocationTargetException - If an exception occurred while invoking the constructor or
factory methodClassNotFoundException - If it was not possible to create a class from a stringprivate Type[] mergeTypeArrays(Type[] original, Type[] extra)
original - The main arrayextra - The additional array, optionally may be nullprivate Object returnAttributeDataStrategyValue(Class<?> attributeType, AttributeStrategy<?> attributeStrategy) throws InstantiationException, IllegalAccessException
PodamStrategyValue annotation with
which the attribute was annotatedattributeType - The attribute type, used for type checkingattributeStrategy - The AttributeStrategy to usePodamStrategyValue annotation with
which the attribute was annotatedInstantiationException - If an exception occurred while creating an instance of the
strategy contained within the PodamStrategyValue
annotationIllegalAccessException - If an exception occurred while creating an instance of the
strategy contained within the PodamStrategyValue
annotationIllegalArgumentException - If the type of the data strategy defined for the
PodamStrategyValue annotation is not assignable to
the annotated attribute. This de facto guarantees type
safety.Copyright © 2015. All rights reserved.