org.databene.benerator.factory
Class DescriptorUtil

java.lang.Object
  extended by 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 Converter<java.lang.String,java.lang.String> createScriptConverter(BeneratorContext context)
           
static Converter getConverter(TypeDescriptor descriptor, BeneratorContext context)
           
static Expression<java.lang.Long> getCount(InstanceDescriptor descriptor)
          Calculates the 'count' value.
static 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 Expression<java.lang.Long> getMaxCount(InstanceDescriptor descriptor)
           
protected static java.lang.Integer getMaxLength(SimpleTypeDescriptor descriptor)
           
static Expression<java.lang.Long> getMinCount(InstanceDescriptor descriptor)
           
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 java.text.DateFormat getPatternAsDateFormat(TypeDescriptor descriptor)
           
static char getSeparator(TypeDescriptor descriptor, BeneratorContext context)
           
static Expression<java.lang.Boolean> getUniqueness(InstanceDescriptor descriptor)
           
static Validator getValidator(TypeDescriptor descriptor, BeneratorContext context)
           
static boolean isUnique(InstanceDescriptor descriptor)
           
static boolean isWrappedSimpleType(ComplexTypeDescriptor complexType)
           
static
<T> Generator<T>
wrapGeneratorWithVariables(TypeDescriptor type, BeneratorContext context, Generator<T> generator)
           
static
<T> Generator<T>
wrapWithProxy(Generator<T> generator, boolean cyclic)
           
static
<T> Generator<T>
wrapWithProxy(Generator<T> generator, TypeDescriptor descriptor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

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 Validator getValidator(TypeDescriptor descriptor,
                                     BeneratorContext context)

getConverter

public static 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 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 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 Expression<java.lang.Long> getMinCount(InstanceDescriptor descriptor)

getMaxCount

public static Expression<java.lang.Long> getMaxCount(InstanceDescriptor descriptor)

getCountPrecision

public static Expression<java.lang.Long> getCountPrecision(InstanceDescriptor descriptor)

wrapGeneratorWithVariables

public static <T> Generator<T> wrapGeneratorWithVariables(TypeDescriptor type,
                                                          BeneratorContext context,
                                                          Generator<T> generator)

createScriptConverter

public static 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)

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)

getMinLength

protected static java.lang.Integer getMinLength(SimpleTypeDescriptor descriptor)

getMaxLength

protected static java.lang.Integer getMaxLength(SimpleTypeDescriptor descriptor)


Copyright © 2010. All Rights Reserved.