org.databene.benerator.factory
Class DescriptorUtil
java.lang.Object
org.databene.benerator.factory.DescriptorUtil
public class DescriptorUtil
- extends java.lang.Object
Utility class for parsing and combining descriptor settings.
Created at 31.12.2008 09:28:28
- Since:
- 0.5.7
- Author:
- Volker Bergmann
|
Method Summary |
static java.lang.Object |
convertType(java.lang.Object sourceValue,
SimpleTypeDescriptor targetType)
|
static Generator<Entity> |
createRawEntitySourceGenerator(TypeDescriptor complexType,
BeneratorContext context,
java.lang.String sourceName,
SourceFactory factory)
|
static org.databene.commons.Converter<java.lang.String,java.lang.String> |
createScriptConverter(BeneratorContext context)
|
static org.databene.commons.Converter |
getConverter(TypeDescriptor descriptor,
BeneratorContext context)
|
static org.databene.commons.Expression<java.lang.Long> |
getCount(InstanceDescriptor descriptor)
Calculates the 'count' value. |
static org.databene.commons.Expression<java.lang.Long> |
getCountPrecision(InstanceDescriptor descriptor)
|
static Generator<?> |
getGeneratorByName(TypeDescriptor descriptor,
BeneratorContext context)
|
static java.util.Locale |
getLocale(TypeDescriptor descriptor)
|
static
<T extends java.lang.Number>
T |
|
getMax(SimpleTypeDescriptor descriptor,
java.lang.Class<T> targetType,
boolean unique)
|
static org.databene.commons.Expression<java.lang.Long> |
getMaxCount(InstanceDescriptor descriptor)
|
protected static java.lang.Integer |
getMaxLength(SimpleTypeDescriptor descriptor)
|
static org.databene.commons.Expression<java.lang.Long> |
getMinCount(InstanceDescriptor descriptor)
|
static org.databene.commons.Expression<java.lang.Long> |
getMinCount(InstanceDescriptor descriptor,
long defaultMin)
|
protected static java.lang.Integer |
getMinLength(SimpleTypeDescriptor descriptor)
|
static double |
getNullQuota(InstanceDescriptor descriptor)
|
static
<T extends java.lang.Number>
T |
|
getNumberDetail(SimpleTypeDescriptor descriptor,
java.lang.String detailName,
java.lang.Class<T> targetType)
|
static
<T extends java.lang.Number>
T |
|
getNumberDetailOrDefault(SimpleTypeDescriptor descriptor,
java.lang.String detailName,
java.lang.Class<T> targetType)
|
static java.text.DateFormat |
getPatternAsDateFormat(TypeDescriptor descriptor)
|
static char |
getSeparator(TypeDescriptor descriptor,
BeneratorContext context)
|
static org.databene.commons.Expression<java.lang.Boolean> |
getUniqueness(InstanceDescriptor descriptor)
|
static org.databene.commons.Validator |
getValidator(TypeDescriptor descriptor,
BeneratorContext context)
|
static boolean |
isUnique(InstanceDescriptor descriptor)
|
static boolean |
isWrappedSimpleType(ComplexTypeDescriptor complexType)
|
static void |
parseComponentConfig(org.w3c.dom.Element element,
TypeDescriptor type,
BeneratorContext context)
|
static java.util.Map<java.lang.String,NullableGenerator<?>> |
parseVariables(TypeDescriptor type,
BeneratorContext context)
|
static
|
wrapWithProxy(Generator<T> generator,
boolean cyclic)
|
static
|
wrapWithProxy(Generator<T> generator,
TypeDescriptor descriptor)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
convertType
public static java.lang.Object convertType(java.lang.Object sourceValue,
SimpleTypeDescriptor targetType)
isWrappedSimpleType
public static boolean isWrappedSimpleType(ComplexTypeDescriptor complexType)
getGeneratorByName
public static Generator<?> getGeneratorByName(TypeDescriptor descriptor,
BeneratorContext context)
getValidator
public static org.databene.commons.Validator getValidator(TypeDescriptor descriptor,
BeneratorContext context)
getConverter
public static org.databene.commons.Converter getConverter(TypeDescriptor descriptor,
BeneratorContext context)
getLocale
public static java.util.Locale getLocale(TypeDescriptor descriptor)
getPatternAsDateFormat
public static java.text.DateFormat getPatternAsDateFormat(TypeDescriptor descriptor)
isUnique
public static boolean isUnique(InstanceDescriptor descriptor)
getUniqueness
public static org.databene.commons.Expression<java.lang.Boolean> getUniqueness(InstanceDescriptor descriptor)
getNullQuota
public static double getNullQuota(InstanceDescriptor descriptor)
wrapWithProxy
public static <T> Generator<T> wrapWithProxy(Generator<T> generator,
TypeDescriptor descriptor)
wrapWithProxy
public static <T> Generator<T> wrapWithProxy(Generator<T> generator,
boolean cyclic)
getSeparator
public static char getSeparator(TypeDescriptor descriptor,
BeneratorContext context)
getCount
public static org.databene.commons.Expression<java.lang.Long> getCount(InstanceDescriptor descriptor)
- Calculates the 'count' value.
- Returns:
- the 'count' value. If a global 'maxCount' was set too, it returns the minimum
of 'count' and 'maxCount'. If no 'count' value was specified, it returns null.
getMinCount
public static org.databene.commons.Expression<java.lang.Long> getMinCount(InstanceDescriptor descriptor)
getMinCount
public static org.databene.commons.Expression<java.lang.Long> getMinCount(InstanceDescriptor descriptor,
long defaultMin)
getMaxCount
public static org.databene.commons.Expression<java.lang.Long> getMaxCount(InstanceDescriptor descriptor)
getCountPrecision
public static org.databene.commons.Expression<java.lang.Long> getCountPrecision(InstanceDescriptor descriptor)
parseVariables
public static java.util.Map<java.lang.String,NullableGenerator<?>> parseVariables(TypeDescriptor type,
BeneratorContext context)
createScriptConverter
public static org.databene.commons.Converter<java.lang.String,java.lang.String> createScriptConverter(BeneratorContext context)
getMax
public static <T extends java.lang.Number> T getMax(SimpleTypeDescriptor descriptor,
java.lang.Class<T> targetType,
boolean unique)
getNumberDetailOrDefault
public static <T extends java.lang.Number> T getNumberDetailOrDefault(SimpleTypeDescriptor descriptor,
java.lang.String detailName,
java.lang.Class<T> targetType)
getNumberDetail
public static <T extends java.lang.Number> T getNumberDetail(SimpleTypeDescriptor descriptor,
java.lang.String detailName,
java.lang.Class<T> targetType)
createRawEntitySourceGenerator
public static Generator<Entity> createRawEntitySourceGenerator(TypeDescriptor complexType,
BeneratorContext context,
java.lang.String sourceName,
SourceFactory factory)
parseComponentConfig
public static void parseComponentConfig(org.w3c.dom.Element element,
TypeDescriptor type,
BeneratorContext context)
getMinLength
protected static java.lang.Integer getMinLength(SimpleTypeDescriptor descriptor)
getMaxLength
protected static java.lang.Integer getMaxLength(SimpleTypeDescriptor descriptor)
Copyright © 2011. All Rights Reserved.