Class AnnotatedConverter<T>

java.lang.Object
org.cyclopsgroup.caff.conversion.AnnotatedConverter<T>
Type Parameters:
T - Type of value to converter from/to
All Implemented Interfaces:
Converter<T>

public class AnnotatedConverter<T> extends Object implements Converter<T>
Converter that converts based on rules defined in annotation
Author:
Jiaqi Guo
  • Constructor Details

    • AnnotatedConverter

      public AnnotatedConverter(Class<T> type, AnnotatedElement firstElement, AnnotatedElement... additionalElements)
      Constructor with an annotated element with annotations.
      Parameters:
      type - the kind of bean to convert from/to.
      firstElement - is the first element in array to add.
      additionalElements - the rest of elements as an array.
    • AnnotatedConverter

      public AnnotatedConverter(Class<T> type, Annotation annotation)
      Constructor with given Annotation
      Parameters:
      type - Value type to convert from/to
      annotation - Annotation that defines conversion rule
    • AnnotatedConverter

      public AnnotatedConverter(Class<T> type, Iterable<AnnotatedElement> elements)
      Constructor with an annotated element with annotations.
      Parameters:
      type - Type to convert from/to.
      elements - Iterable of annotated elements.
    • AnnotatedConverter

      public AnnotatedConverter(Class<T> type, PropertyDescriptor descriptor)
      Constructor with a property descriptor
      Parameters:
      type - Type of value to convert
      descriptor - Property descriptor
  • Method Details

    • fromCharacters

      public T fromCharacters(CharSequence text)
      Specified by:
      fromCharacters in interface Converter<T>
      Parameters:
      text - Character sequence form of value
      Returns:
      Converted result
    • toCharacters

      public CharSequence toCharacters(T value)
      Specified by:
      toCharacters in interface Converter<T>
      Parameters:
      value - Object instance
      Returns:
      Text form of value