diff --git a/annotations.html b/annotations.html old mode 100644 new mode 100755 index a79215a88..22da2267b --- a/annotations.html +++ b/annotations.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -27,7 +27,7 @@
- Version: 7.1.1.RELEASE + Version: 8.0.0.RELEASE
Podam @ GitHub | @@ -97,7 +97,7 @@
Project Documentation
- @@ -110,444 +110,460 @@
Project Documentation
-
-

Podam Custom Annotations

-

For the full syntax of PODAM annotations, please refer to the Javadocs

-
-

@PodamStrategyValue

-

This is probably the most valuable annotation of all. It allows users to define the strategy PODAM should use at the attribute level. To create a custom strategy, create an implementation of the AttributeStrategy<T> interface and use it in the value attribute of this annotation.

-

Example:

-
-
-@PodamStrategyValue(PostCodeStrategy.class)
-private String postCode;
-
-@PodamStrategyValue(MyBirthdayStrategy.class)
-private Calendar myBirthday;
-
-
-

@PodamBooleanValue

-

It allows the customisation of boolean / Boolean attributes.

- - - - - - -
AttributeDescription
boolValueIt dictates the value that will be assigned to the annotated attribute. Can only be true or false
-

Example:

-
-
-/** A boolean field with value forced to true */
-@PodamBooleanValue(boolValue = true)
-private boolean boolDefaultToTrue;
-
-/** A boolean field with value forced to false */
-@PodamBooleanValue(boolValue = false)
-private boolean boolDefaultToFalse = true;
-
-

Top

-
-

@PodamByteValue

-

It allows the customisation of byte / Byte attributes.

- - - - - - - - - - - - -
AttributeDescription
numValueTakes precedence over all other attributes. It dictates the value that will be assigned to the annotated attribute
minValueIt identifies the minimum value (inclusive) that the annotated attribute will be assigned.
maxValueIt identifies the maximum value (inclusive) that the annotated attribute will be assigned.
-

Example:

-
-
-@PodamByteValue(minValue = PodamTestConstants.NUMBER_INT_MIN_VALUE)
-private byte byteFieldWithMinValueOnly;
-
-@PodamByteValue(maxValue = PodamTestConstants.NUMBER_INT_ONE_HUNDRED)
-private byte byteFieldWithMaxValueOnly;
-
-@PodamByteValue(minValue = PodamTestConstants.NUMBER_INT_MIN_VALUE, maxValue = PodamTestConstants.NUMBER_INT_ONE_HUNDRED)
-private byte byteFieldWithMinAndMaxValue;  
-
-@PodamByteValue(numValue = PodamTestConstants.BYTE_PRECISE_VALUE)
-private byte byteFieldWithPreciseValue;
-
-

Top

-
-

@PodamShortValue

-

It allows the customisation of short / Short attributes.

- - - - - - - - - - - - -
AttributeDescription
numValueTakes precedence over all other attributes. It dictates the value that will be assigned to the annotated attribute
minValueIt identifies the minimum value (inclusive) that the annotated attribute will be assigned.
maxValueIt identifies the maximum value (inclusive) that the annotated attribute will be assigned.
-

Example:

-
-
-@PodamShortValue(minValue = PodamTestConstants.NUMBER_INT_MIN_VALUE)
-private short shortFieldWithMinValueOnly;
-
-@PodamShortValue(maxValue = PodamTestConstants.NUMBER_INT_ONE_HUNDRED)
-private short shortFieldWithMaxValueOnly;
-
-@PodamShortValue(minValue = PodamTestConstants.NUMBER_INT_MIN_VALUE, maxValue = PodamTestConstants.NUMBER_INT_ONE_HUNDRED)
-private short shortFieldWithMinAndMaxValue;
-
-@PodamShortValue(numValue = PodamTestConstants.SHORT_PRECISE_VALUE)
-private short shortFieldWithPreciseValue;
-
-

Top

-
-

@PodamCharValue

-

It allows the customisation of char / Character attributes.

- - - - - - - - - - - - -
AttributeDescription
charValueTakes precedence over all other attributes. It dictates the value that will be assigned to the annotated attribute
minValueIt identifies the minimum value (inclusive) that the annotated attribute will be assigned.
maxValueIt identifies the maximum value (inclusive) that the annotated attribute will be assigned.
-

Example:

-
-
-@PodamCharValue(minValue = PodamTestConstants.NUMBER_INT_MIN_VALUE)
-private char charFieldWithMinValueOnly;
-
-@PodamCharValue(maxValue = PodamTestConstants.NUMBER_INT_ONE_HUNDRED)
-private char charFieldWithMaxValueOnly;
-
-@PodamCharValue(minValue = PodamTestConstants.NUMBER_INT_MIN_VALUE, maxValue = PodamTestConstants.NUMBER_INT_ONE_HUNDRED)
-private char charFieldWithMinAndMaxValue;
-
-@PodamCharValue(charValue = PodamTestConstants.CHAR_PRECISE_VALUE)
-private char charFieldWithPreciseValue;
-
-

Top

-
-

@PodamIntValue

-

It allows the customisation of int / Integer attributes.

- - - - - - - - - - - - -
AttributeDescription
numValueTakes precedence over all other attributes. It dictates the value that will be assigned to the annotated attribute
minValueIt identifies the minimum value (inclusive) that the annotated attribute will be assigned.
maxValueIt identifies the maximum value (inclusive) that the annotated attribute will be assigned.
-

Example:

-
-
-@PodamIntValue(minValue = PodamTestConstants.NUMBER_INT_MIN_VALUE)
-private int intFieldWithMinValueOnly;
-
-@PodamIntValue(numValue = PodamTestConstants.INTEGER_PRECISE_VALUE)
-private int intFieldWithPreciseValue;
-
-@PodamIntValue(maxValue = PodamTestConstants.NUMBER_INT_ONE_HUNDRED)
-private int intFieldWithMaxValueOnly;
-
-@PodamIntValue(numValue = PodamTestConstants.INTEGER_PRECISE_VALUE)
-private Integer integerObjectFieldWithPreciseValue;
-
-

Top

-
-

@PodamLongValue

-

It allows the customisation of long / Long attributes.

- - - - - - - - - - - - -
AttributeDescription
numValueTakes precedence over all other attributes. It dictates the value that will be assigned to the annotated attribute
minValueIt identifies the minimum value (inclusive) that the annotated attribute will be assigned.
maxValueIt identifies the maximum value (inclusive) that the annotated attribute will be assigned.
-

Example:

-
-
-@PodamLongValue(minValue = 0)
-private long longFieldWithMinValueOnly;
-
-@PodamLongValue(maxValue = 100)
-private long longFieldWithMaxValueOnly;
-
-@PodamLongValue(minValue = 0, maxValue = 1000)
-private long longFieldWithMinAndMaxValue;
-
-@PodamLongValue(numValue = PodamTestConstants.LONG_PRECISE_VALUE)
-private Long longObjectFieldWithPreciseValue;
-
-

Top

-
-

@PodamFloatValue

-

It allows the customisation of float / Float attributes.

- - - - - - - - - - - - -
AttributeDescription
numValueTakes precedence over all other attributes. It dictates the value that will be assigned to the annotated attribute
minValueIt identifies the minimum value (inclusive) that the annotated attribute will be assigned.
maxValueIt identifies the maximum value (inclusive) that the annotated attribute will be assigned.
-

Example:

-
-
-@PodamFloatValue(minValue = PodamTestConstants.NUMBER_FLOAT_MIN_VALUE)
-private float floatFieldWithMinValueOnly;
-
-@PodamFloatValue(maxValue = PodamTestConstants.NUMBER_FLOAT_ONE_HUNDRED)
-private float floatFieldWithMaxValueOnly;
-
-@PodamFloatValue(minValue = PodamTestConstants.NUMBER_FLOAT_MIN_VALUE, maxValue = PodamTestConstants.NUMBER_FLOAT_MAX_VALUE)
-private float floatFieldWithMinAndMaxValue;
-
-@PodamFloatValue(numValue = PodamTestConstants.FLOAT_PRECISE_VALUE)
-private Float floatObjectFieldWithPreciseValue;
-
-

Top

-
-

@PodamDoubleValue

-

It allows the customisation of double / Double attributes.

- - - - - - - - - - - - -
AttributeDescription
numValueTakes precedence over all other attributes. It dictates the value that will be assigned to the annotated attribute
minValueIt identifies the minimum value (inclusive) that the annotated attribute will be assigned.
maxValueIt identifies the maximum value (inclusive) that the annotated attribute will be assigned.
-

Example:

-
-
-@PodamDoubleValue(minValue = PodamTestConstants.NUMBER_DOUBLE_MIN_VALUE)
-private double doubleFieldWithMinValueOnly;
-
-@PodamDoubleValue(maxValue = PodamTestConstants.NUMBER_DOUBLE_ONE_HUNDRED)
-private double doubleFieldWithMaxValueOnly;
-
-@PodamDoubleValue(minValue = PodamTestConstants.NUMBER_DOUBLE_MIN_VALUE, maxValue = PodamTestConstants.NUMBER_DOUBLE_MAX_VALUE)
-private double doubleFieldWithMinAndMaxValue;
-
-@PodamDoubleValue(numValue = PodamTestConstants.DOUBLE_PRECISE_VALUE)
-private Double doubleObjectFieldWithPreciseValue;
-
-

Top

-
-

@PodamStringValue

-

It allows the customisation of String attributes

- - - - - - - - - -
AttributeDescription
strValueTakes precedence over all other attributes. It dictates the value that will be assigned to the annotated attribute
lengthIt defines how long the string shall be. This attribute will be taken into consideration only if strValue has not been defined.
-

Example:

-
-
-@PodamStringValue(length = PodamTestConstants.STR_ANNOTATION_TWENTY_LENGTH)
-/** A String attribute with length 20 */
-private String twentyLengthString;
-
-@PodamStringValue(strValue = PodamTestConstants.STR_ANNOTATION_PRECISE_VALUE)
-private String preciseValueString;
-
-

Top

-
-

@PodamCollection

-

It allows the customisation of container-like data structures, such as Collections, Maps and Arrays. The default strategy for all container-like data structure is uk.co.jemos.podam.annotations.strategies.ObjectStrategy whose behaviour is to return a new Object instance. This strategy will be used only if the container element type is Object itself. Otherwise the element type wins.

- - - - - - - - - - - - - - - -
AttributeDescription
nbrElementsIt defines how many elements should be created for the container-like data structure
collectionElementStrategyIt defines which AttributeStrategy<T> should be used to fill each element in the collection. Used for Collections and Arrays. Not used for Maps.
mapKeyStrategyIt defines which AttributeStrategy<T> should be used to fill keys of a Map. Used only for Maps
mapElementStrategyIt defines which AttributeStrategy<T> should be used to fill elements of a Map. Used only for Maps
-

Example for a Collection. It will fill a ListCalendar with two elements. Each element will be filled according to the MyBirthdayStrategy strategy.

-
-
-@PodamCollection(nbrElements = 2, collectionElementStrategy = MyBirthdayStrategy.class)
-private List<Calendar> myBirthdays = new ArrayList<Calendar>();
-
-

Example for a Map. It will fill a MapString, Calendar with two elements. Each Map element will be filled according to the MyBirthdayStrategy strategy.

-
-
-@PodamCollection(nbrElements = 2, mapElementStrategy = MyBirthdayStrategy.class)
-private Map<String, Calendar> myBirthdaysMap = new HashMap<String, Calendar>();
-
-

Example for an Array. It will fill an array of Calendars. Each array element will be filled according to the MyBirthdayStrategy strategy.

-
-
-@PodamCollection(nbrElements = 2, collectionElementStrategy = MyBirthdayStrategy.class)
-private Calendar[] myBirthdaysArray;
-
-

Top

-
-

@PodamConstructor

-

Allows a constructor to be identified in a setter-less POJO. This is a PODAM requirement: for those POJOs without setters (e.g. immutable classes) a constructor annotated with this annotations is required. @PodamConstructor can be used as a marker interface.

- - - - - - -
AttributeDescription
commentIt allows users to write a comment on the use of this annotation
-

Example:

-
-
/**
- * 
- */
-package uk.co.jemos.podam.test.dto;
-
-import java.io.Serializable;
-import java.util.Arrays;
-import java.util.Calendar;
-
-import net.jcip.annotations.Immutable;
-import uk.co.jemos.podam.annotations.PodamConstructor;
-
-/**
- * This is an immutable POJO to test PODAM's ability to create an instance which
- * hasn't got setters
- * 
- * @author mtedone
- * 
- */
-@Immutable
-public class ImmutableNoHierarchicalAnnotatedPojo implements Serializable {     
-
-        private static final long serialVersionUID = 1L;
-        
-
-        /** An int field */
-        private final int intField;
-
-        /** A Calendar field */
-        private final Calendar dateCreated;
-
-        /** An array of longs */
-        private final long[] longArray; 
-
-        /**
-         * Full constructor
-         * 
-         * @param intField
-         * @param dateCreated
-         * @param longArray
-         */
-        @PodamConstructor
-        public ImmutableNoHierarchicalAnnotatedPojo(int intField, Calendar dateCreated,
-                        long[] longArray) {
-                super();
-                this.intField = intField;
-                this.dateCreated = dateCreated;
-                this.longArray = longArray;
-        }
-
-        
-        /**
-         * @return the intField
-         */
-        public int getIntField() {
-                return intField;
-        }
-
-        /**
-         * @return the dateCreated
-         */
-        public Calendar getDateCreated() {
-                return dateCreated;
-        }
-
-        /**
-         * @return the longArray
-         */
-        public long[] getLongArray() {
-                return longArray;
-        }
-
-
-}
-
-

Top

-
-

@PodamExclude

-

This annotation is used to instruct PODAM to skip the initialisation of a certain attribute.

- - - - - - -
AttributeDescription
commentIt allows users to write a comment on the use of this annotation
-

Example:

-
-
-        public class Pojo {
-
-                /** PODAM will not fill this attribute */
-                @PodamExclude
-                private SimplePojoToTestSetters somePojo;
-        }
-
-

An alternative to this annotation is reloading ClassInfoStrategy.getExcludedFields()

-

Example:

-
-
-        private final static DefaultClassInfoStrategy classInfoStrategy =
-                        DefaultClassInfoStrategy.getInstance();
-        classInfoStrategy.addExcludedField(Pojo.class, "somePojo");
+        
+

Podam Custom Annotations

+

For the full syntax of PODAM annotations, please refer to the Javadocs

+
+

@PodamStrategyValue

+

This is probably the most valuable annotation of all. It allows users to define the strategy PODAM should use at the attribute level. To create a custom strategy, create an implementation of the AttributeStrategy<T> interface and use it in the value attribute of this annotation.

+

Example:

+
+
+@PodamStrategyValue(PostCodeStrategy.class)
+private String postCode;
+
+@PodamStrategyValue(MyBirthdayStrategy.class)
+private Calendar myBirthday;
+
+
+
+

@PodamBooleanValue

+

It allows the customisation of boolean / Boolean attributes.

+ + + + + + +
AttributeDescription
boolValueIt dictates the value that will be assigned to the annotated attribute. Can only be true or false
+

Example:

+
+
+/** A boolean field with value forced to true */
+@PodamBooleanValue(boolValue = true)
+private boolean boolDefaultToTrue;
+
+/** A boolean field with value forced to false */
+@PodamBooleanValue(boolValue = false)
+private boolean boolDefaultToFalse = true;
+
+
+

Top

+
+

@PodamByteValue

+

It allows the customisation of byte / Byte attributes.

+ + + + + + + + + + + + +
AttributeDescription
numValueTakes precedence over all other attributes. It dictates the value that will be assigned to the annotated attribute
minValueIt identifies the minimum value (inclusive) that the annotated attribute will be assigned.
maxValueIt identifies the maximum value (inclusive) that the annotated attribute will be assigned.
+

Example:

+
+
+@PodamByteValue(minValue = PodamTestConstants.NUMBER_INT_MIN_VALUE)
+private byte byteFieldWithMinValueOnly;
+
+@PodamByteValue(maxValue = PodamTestConstants.NUMBER_INT_ONE_HUNDRED)
+private byte byteFieldWithMaxValueOnly;
+
+@PodamByteValue(minValue = PodamTestConstants.NUMBER_INT_MIN_VALUE, maxValue = PodamTestConstants.NUMBER_INT_ONE_HUNDRED)
+private byte byteFieldWithMinAndMaxValue;  
+
+@PodamByteValue(numValue = PodamTestConstants.BYTE_PRECISE_VALUE)
+private byte byteFieldWithPreciseValue;
+
+
+

Top

+
+

@PodamShortValue

+

It allows the customisation of short / Short attributes.

+ + + + + + + + + + + + +
AttributeDescription
numValueTakes precedence over all other attributes. It dictates the value that will be assigned to the annotated attribute
minValueIt identifies the minimum value (inclusive) that the annotated attribute will be assigned.
maxValueIt identifies the maximum value (inclusive) that the annotated attribute will be assigned.
+

Example:

+
+
+@PodamShortValue(minValue = PodamTestConstants.NUMBER_INT_MIN_VALUE)
+private short shortFieldWithMinValueOnly;
+
+@PodamShortValue(maxValue = PodamTestConstants.NUMBER_INT_ONE_HUNDRED)
+private short shortFieldWithMaxValueOnly;
+
+@PodamShortValue(minValue = PodamTestConstants.NUMBER_INT_MIN_VALUE, maxValue = PodamTestConstants.NUMBER_INT_ONE_HUNDRED)
+private short shortFieldWithMinAndMaxValue;
+
+@PodamShortValue(numValue = PodamTestConstants.SHORT_PRECISE_VALUE)
+private short shortFieldWithPreciseValue;
+
+
+

Top

+
+

@PodamCharValue

+

It allows the customisation of char / Character attributes.

+ + + + + + + + + + + + +
AttributeDescription
charValueTakes precedence over all other attributes. It dictates the value that will be assigned to the annotated attribute
minValueIt identifies the minimum value (inclusive) that the annotated attribute will be assigned.
maxValueIt identifies the maximum value (inclusive) that the annotated attribute will be assigned.
+

Example:

+
+
+@PodamCharValue(minValue = PodamTestConstants.NUMBER_INT_MIN_VALUE)
+private char charFieldWithMinValueOnly;
+
+@PodamCharValue(maxValue = PodamTestConstants.NUMBER_INT_ONE_HUNDRED)
+private char charFieldWithMaxValueOnly;
+
+@PodamCharValue(minValue = PodamTestConstants.NUMBER_INT_MIN_VALUE, maxValue = PodamTestConstants.NUMBER_INT_ONE_HUNDRED)
+private char charFieldWithMinAndMaxValue;
+
+@PodamCharValue(charValue = PodamTestConstants.CHAR_PRECISE_VALUE)
+private char charFieldWithPreciseValue;
+
+
+

Top

+
+

@PodamIntValue

+

It allows the customisation of int / Integer attributes.

+ + + + + + + + + + + + +
AttributeDescription
numValueTakes precedence over all other attributes. It dictates the value that will be assigned to the annotated attribute
minValueIt identifies the minimum value (inclusive) that the annotated attribute will be assigned.
maxValueIt identifies the maximum value (inclusive) that the annotated attribute will be assigned.
+

Example:

+
+
+@PodamIntValue(minValue = PodamTestConstants.NUMBER_INT_MIN_VALUE)
+private int intFieldWithMinValueOnly;
+
+@PodamIntValue(numValue = PodamTestConstants.INTEGER_PRECISE_VALUE)
+private int intFieldWithPreciseValue;
+
+@PodamIntValue(maxValue = PodamTestConstants.NUMBER_INT_ONE_HUNDRED)
+private int intFieldWithMaxValueOnly;
+
+@PodamIntValue(numValue = PodamTestConstants.INTEGER_PRECISE_VALUE)
+private Integer integerObjectFieldWithPreciseValue;
+
+
+

Top

+
+

@PodamLongValue

+

It allows the customisation of long / Long attributes.

+ + + + + + + + + + + + +
AttributeDescription
numValueTakes precedence over all other attributes. It dictates the value that will be assigned to the annotated attribute
minValueIt identifies the minimum value (inclusive) that the annotated attribute will be assigned.
maxValueIt identifies the maximum value (inclusive) that the annotated attribute will be assigned.
+

Example:

+
+
+@PodamLongValue(minValue = 0)
+private long longFieldWithMinValueOnly;
+
+@PodamLongValue(maxValue = 100)
+private long longFieldWithMaxValueOnly;
+
+@PodamLongValue(minValue = 0, maxValue = 1000)
+private long longFieldWithMinAndMaxValue;
+
+@PodamLongValue(numValue = PodamTestConstants.LONG_PRECISE_VALUE)
+private Long longObjectFieldWithPreciseValue;
+
+
+

Top

+
+

@PodamFloatValue

+

It allows the customisation of float / Float attributes.

+ + + + + + + + + + + + +
AttributeDescription
numValueTakes precedence over all other attributes. It dictates the value that will be assigned to the annotated attribute
minValueIt identifies the minimum value (inclusive) that the annotated attribute will be assigned.
maxValueIt identifies the maximum value (inclusive) that the annotated attribute will be assigned.
+

Example:

+
+
+@PodamFloatValue(minValue = PodamTestConstants.NUMBER_FLOAT_MIN_VALUE)
+private float floatFieldWithMinValueOnly;
+
+@PodamFloatValue(maxValue = PodamTestConstants.NUMBER_FLOAT_ONE_HUNDRED)
+private float floatFieldWithMaxValueOnly;
+
+@PodamFloatValue(minValue = PodamTestConstants.NUMBER_FLOAT_MIN_VALUE, maxValue = PodamTestConstants.NUMBER_FLOAT_MAX_VALUE)
+private float floatFieldWithMinAndMaxValue;
+
+@PodamFloatValue(numValue = PodamTestConstants.FLOAT_PRECISE_VALUE)
+private Float floatObjectFieldWithPreciseValue;
+
+
+

Top

+
+

@PodamDoubleValue

+

It allows the customisation of double / Double attributes.

+ + + + + + + + + + + + +
AttributeDescription
numValueTakes precedence over all other attributes. It dictates the value that will be assigned to the annotated attribute
minValueIt identifies the minimum value (inclusive) that the annotated attribute will be assigned.
maxValueIt identifies the maximum value (inclusive) that the annotated attribute will be assigned.
+

Example:

+
+
+@PodamDoubleValue(minValue = PodamTestConstants.NUMBER_DOUBLE_MIN_VALUE)
+private double doubleFieldWithMinValueOnly;
+
+@PodamDoubleValue(maxValue = PodamTestConstants.NUMBER_DOUBLE_ONE_HUNDRED)
+private double doubleFieldWithMaxValueOnly;
+
+@PodamDoubleValue(minValue = PodamTestConstants.NUMBER_DOUBLE_MIN_VALUE, maxValue = PodamTestConstants.NUMBER_DOUBLE_MAX_VALUE)
+private double doubleFieldWithMinAndMaxValue;
+
+@PodamDoubleValue(numValue = PodamTestConstants.DOUBLE_PRECISE_VALUE)
+private Double doubleObjectFieldWithPreciseValue;
+
+
+

Top

+
+

@PodamStringValue

+

It allows the customisation of String attributes

+ + + + + + + + + +
AttributeDescription
strValueTakes precedence over all other attributes. It dictates the value that will be assigned to the annotated attribute
lengthIt defines how long the string shall be. This attribute will be taken into consideration only if strValue has not been defined.
+

Example:

+
+
+@PodamStringValue(length = PodamTestConstants.STR_ANNOTATION_TWENTY_LENGTH)
+/** A String attribute with length 20 */
+private String twentyLengthString;
+
+@PodamStringValue(strValue = PodamTestConstants.STR_ANNOTATION_PRECISE_VALUE)
+private String preciseValueString;
+
+
+

Top

+
+

@PodamCollection

+

It allows the customisation of container-like data structures, such as Collections, Maps and Arrays. The default strategy for all container-like data structure is uk.co.jemos.podam.annotations.strategies.ObjectStrategy whose behaviour is to return a new Object instance. This strategy will be used only if the container element type is Object itself. Otherwise the element type wins.

+ + + + + + + + + + + + + + + +
AttributeDescription
nbrElementsIt defines how many elements should be created for the container-like data structure
collectionElementStrategyIt defines which AttributeStrategy<T> should be used to fill each element in the collection. Used for Collections and Arrays. Not used for Maps.
mapKeyStrategyIt defines which AttributeStrategy<T> should be used to fill keys of a Map. Used only for Maps
mapElementStrategyIt defines which AttributeStrategy<T> should be used to fill elements of a Map. Used only for Maps
+

Example for a Collection. It will fill a ListCalendar with two elements. Each element will be filled according to the MyBirthdayStrategy strategy.

+
+
+@PodamCollection(nbrElements = 2, collectionElementStrategy = MyBirthdayStrategy.class)
+private List<Calendar> myBirthdays = new ArrayList<Calendar>();
+
+
+

Example for a Map. It will fill a MapString, Calendar with two elements. Each Map element will be filled according to the MyBirthdayStrategy strategy.

+
+
+@PodamCollection(nbrElements = 2, mapElementStrategy = MyBirthdayStrategy.class)
+private Map<String, Calendar> myBirthdaysMap = new HashMap<String, Calendar>();
+
+
+

Example for an Array. It will fill an array of Calendars. Each array element will be filled according to the MyBirthdayStrategy strategy.

+
+
+@PodamCollection(nbrElements = 2, collectionElementStrategy = MyBirthdayStrategy.class)
+private Calendar[] myBirthdaysArray;
+
+
+

Top

+
+

@PodamConstructor

+

Allows a constructor to be identified in a setter-less POJO. This is a PODAM requirement: for those POJOs without setters (e.g. immutable classes) a constructor annotated with this annotations is required. @PodamConstructor can be used as a marker interface.

+ + + + + + +
AttributeDescription
commentIt allows users to write a comment on the use of this annotation
+

Example:

+
+
/**
+ * 
+ */
+package uk.co.jemos.podam.test.dto;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.Calendar;
+
+import net.jcip.annotations.Immutable;
+import uk.co.jemos.podam.annotations.PodamConstructor;
+
+/**
+ * This is an immutable POJO to test PODAM's ability to create an instance which
+ * hasn't got setters
+ * 
+ * @author mtedone
+ * 
+ */
+@Immutable
+public class ImmutableNoHierarchicalAnnotatedPojo implements Serializable {     
+
+        private static final long serialVersionUID = 1L;
+        
+
+        /** An int field */
+        private final int intField;
+
+        /** A Calendar field */
+        private final Calendar dateCreated;
+
+        /** An array of longs */
+        private final long[] longArray; 
+
+        /**
+         * Full constructor
+         * 
+         * @param intField
+         * @param dateCreated
+         * @param longArray
+         */
+        @PodamConstructor
+        public ImmutableNoHierarchicalAnnotatedPojo(int intField, Calendar dateCreated,
+                        long[] longArray) {
+                super();
+                this.intField = intField;
+                this.dateCreated = dateCreated;
+                this.longArray = longArray;
+        }
+
+        
+        /**
+         * @return the intField
+         */
+        public int getIntField() {
+                return intField;
+        }
+
+        /**
+         * @return the dateCreated
+         */
+        public Calendar getDateCreated() {
+                return dateCreated;
+        }
+
+        /**
+         * @return the longArray
+         */
+        public long[] getLongArray() {
+                return longArray;
+        }
+
+
+}
+
+
+

Top

+
+

@PodamExclude

+

This annotation is used to instruct PODAM to skip the initialisation of a certain attribute.

+ + + + + + +
AttributeDescription
commentIt allows users to write a comment on the use of this annotation
+

Example:

+
+
+        public class Pojo {
+
+                /** PODAM will not fill this attribute */
+                @PodamExclude
+                private SimplePojoToTestSetters somePojo;
+        }
+
+
+

An alternative to this annotation is reloading ClassInfoStrategy.getExcludedFields()

+

Example:

+
+
+        private final static DefaultClassInfoStrategy classInfoStrategy =
+                        DefaultClassInfoStrategy.getInstance();
+        classInfoStrategy.addExcludedField(Pojo.class, "somePojo");
+
 
@@ -556,10 +572,10 @@

@PodamExclude