public class BeanValidationStrategy extends Object implements AttributeStrategy<Object>
| Modifier and Type | Field and Description |
|---|---|
private List<Annotation> |
annotations
bean validation annotations
|
private Class<?> |
attributeType
expected return type of an attribute
|
private static org.slf4j.Logger |
LOG |
private static Random |
RANDOM
A RANDOM generator
|
| Constructor and Description |
|---|
BeanValidationStrategy(List<Annotation> annotations,
Class<?> attributeType)
Constructor for the strategy
|
| Modifier and Type | Method and Description |
|---|---|
private Object |
decimalToReturnType(BigDecimal result)
Converts intermediate decimal value to the actual attribute type,
for example, string representation of this decimal
|
private static <T> T |
findTypeFromList(List<?> list,
Class<T> type)
Utility to find an item of a desired type in the given list
|
Object |
getValue()
It returns a
Calendar objects complying with Java bean validation
annotations. |
private BigDecimal |
getValueInRange(BigDecimal min,
BigDecimal max)
Produces random decimal value within specified range
|
private Object |
timestampToReturnType(Long result)
|
private static final org.slf4j.Logger LOG
private static final Random RANDOM
private List<Annotation> annotations
private Class<?> attributeType
public BeanValidationStrategy(List<Annotation> annotations, Class<?> attributeType)
annotations - bean validation annotationsattributeType - expected return type of an attributepublic Object getValue() throws PodamMockeryException
Calendar objects complying with Java bean validation
annotations.
It returns a value of the given typegetValue in interface AttributeStrategy<Object>PodamMockeryException - If an exception occurred while assigning the value specified
by this strategyprivate static <T> T findTypeFromList(List<?> list, Class<T> type)
T - Return type of item to findlist - List to search intype - Type to find in the listprivate BigDecimal getValueInRange(BigDecimal min, BigDecimal max)
min - minimum value of rangemax - maximum value of rangeprivate Object decimalToReturnType(BigDecimal result)
result - BigDecimal intermediate result to convert to the
real attribute typeCopyright © 2015. All rights reserved.