Class DefaultPropertyValueConverter

  • All Implemented Interfaces:
    Serializable

    public class DefaultPropertyValueConverter
    extends AbstractPropertyValueConverter
    Default handler for primitives. Values for arrays are assumed to be blank-separated strings (one element per array value).
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Constructor Detail

      • DefaultPropertyValueConverter

        public DefaultPropertyValueConverter()
    • Method Detail

      • handles

        public boolean handles​(Class cls)
        Checks whether this converter handles the particular class.
        Specified by:
        handles in class AbstractPropertyValueConverter
        Parameters:
        cls - the class to check
        Returns:
        true if it supports it
      • convert

        public Object convert​(Class cls,
                              String value)
                       throws Exception
        Converts the variable value into the appropriate object, if possible.
        Specified by:
        convert in class AbstractPropertyValueConverter
        Parameters:
        cls - the type of the property
        value - the string to convert
        Returns:
        the converted value or null if it cannot be converted
        Throws:
        Exception - if conversion fails with an error