Class MiscConverters.EnumToString

    • Constructor Summary

      Constructors 
      Constructor Description
      EnumToString()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canConvert​(java.lang.Class<?> sourceClass, java.lang.Class<?> targetClass)
      Returns true if this object can convert sourceClass to targetClass.
      java.lang.String convert​(java.lang.Class<? extends java.lang.String> targetClass, java.lang.Enum<?> obj)
      Converts obj to T.
      java.lang.String convert​(java.lang.Enum<?> obj)
      Converts obj to T.
      java.lang.Class<? super java.lang.Enum<?>> getSourceClass()
      Returns the source Class for this converter.
      • Methods inherited from class java.lang.Object

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

      • EnumToString

        public EnumToString()
    • Method Detail

      • canConvert

        public boolean canConvert​(java.lang.Class<?> sourceClass,
                                  java.lang.Class<?> targetClass)
        Description copied from interface: Converter
        Returns true if this object can convert sourceClass to targetClass.

        Implementations can accomodate class hierarchy ranges by converting super classes or interfaces.

        Specified by:
        canConvert in interface Converter<java.lang.Enum<?>,​java.lang.String>
        Overrides:
        canConvert in class AbstractConverter<java.lang.Enum<?>,​java.lang.String>
        Parameters:
        sourceClass - The source Class
        targetClass - The target Class
        Returns:
        true if this object can convert sourceClass to targetClass.
      • convert

        public java.lang.String convert​(java.lang.Enum<?> obj)
                                 throws ConversionException
        Description copied from interface: Converter
        Converts obj to T.
        Parameters:
        obj - The source Object to convert
        Returns:
        The converted Object
        Throws:
        ConversionException
      • convert

        public java.lang.String convert​(java.lang.Class<? extends java.lang.String> targetClass,
                                        java.lang.Enum<?> obj)
                                 throws ConversionException
        Description copied from interface: Converter
        Converts obj to T.
        Specified by:
        convert in interface Converter<java.lang.Enum<?>,​java.lang.String>
        Overrides:
        convert in class AbstractConverter<java.lang.Enum<?>,​java.lang.String>
        Parameters:
        targetClass - The Class to convert to
        obj - The source Object to convert
        Returns:
        The converted Object
        Throws:
        ConversionException
      • getSourceClass

        public java.lang.Class<? super java.lang.Enum<?>> getSourceClass()
        Description copied from interface: Converter
        Returns the source Class for this converter.
        Specified by:
        getSourceClass in interface Converter<java.lang.Enum<?>,​java.lang.String>
        Overrides:
        getSourceClass in class AbstractConverter<java.lang.Enum<?>,​java.lang.String>
        Returns:
        The source Class for this converter