Class ArrayValueConverter

  • All Implemented Interfaces:
    ValueConverter

    public class ArrayValueConverter
    extends java.lang.Object
    implements ValueConverter
    An ValueConverter that handles Arrays. Conversion to arrays is done using a CSV string.
    Author:
    Thomas Morgner
    • Constructor Summary

      Constructors 
      Constructor Description
      ArrayValueConverter​(java.lang.Class arrayClass, ValueConverter elementConverter)
      Creates a new ArrayValueConverter for the given element type and array type.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String toAttributeValue​(java.lang.Object o)
      Converts an object to an attribute value.
      java.lang.Object toPropertyValue​(java.lang.String s)
      Converts a string to a property value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ArrayValueConverter

        public ArrayValueConverter​(java.lang.Class arrayClass,
                                   ValueConverter elementConverter)
        Creates a new ArrayValueConverter for the given element type and array type.
        Parameters:
        arrayClass - the array type
        elementConverter - the value converter for the array elements.
    • Method Detail

      • toAttributeValue

        public java.lang.String toAttributeValue​(java.lang.Object o)
                                          throws BeanException
        Converts an object to an attribute value.
        Specified by:
        toAttributeValue in interface ValueConverter
        Parameters:
        o - the object.
        Returns:
        the attribute value.
        Throws:
        BeanException - if there was an error during the conversion.
      • toPropertyValue

        public java.lang.Object toPropertyValue​(java.lang.String s)
                                         throws BeanException
        Converts a string to a property value.
        Specified by:
        toPropertyValue in interface ValueConverter
        Parameters:
        s - the string.
        Returns:
        a property value.
        Throws:
        BeanException - if there was an error during the conversion.