Package jmri.configurexml
Class AbstractXmlAdapter.EnumIoNames<T extends java.lang.Enum<T>>
- java.lang.Object
-
- jmri.configurexml.AbstractXmlAdapter.EnumIO<T>
-
- jmri.configurexml.AbstractXmlAdapter.EnumIoNames<T>
-
- Type Parameters:
T
- generic enum class.
- Direct Known Subclasses:
AbstractXmlAdapter.EnumIoNamesNumbers
- Enclosing class:
- AbstractXmlAdapter
public static class AbstractXmlAdapter.EnumIoNames<T extends java.lang.Enum<T>> extends AbstractXmlAdapter.EnumIO<T>
Support for Enum I/O to XML using the enum's element names.
-
-
Constructor Summary
Constructors Constructor Description EnumIoNames(java.lang.Class<T> clazz)
This constructor converts to and from strings using the enum element names.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
inputFromString(java.lang.String s)
Convert a String value from an XML file to an enum value.java.lang.String
outputFromEnum(T e)
Convert an enum value to a String for storage in an XML file.-
Methods inherited from class jmri.configurexml.AbstractXmlAdapter.EnumIO
inputFromAttribute
-
-
-
-
Constructor Detail
-
EnumIoNames
public EnumIoNames(@Nonnull java.lang.Class<T> clazz)
This constructor converts to and from strings using the enum element names.- Parameters:
clazz
- enum class.
-
-
Method Detail
-
outputFromEnum
@Nonnull public java.lang.String outputFromEnum(@Nonnull T e)
Convert an enum value to a String for storage in an XML file.- Specified by:
outputFromEnum
in classAbstractXmlAdapter.EnumIO<T extends java.lang.Enum<T>>
- Parameters:
e
- enum value.- Returns:
- storage string.
-
inputFromString
@Nonnull public T inputFromString(@CheckForNull java.lang.String s)
Convert a String value from an XML file to an enum value.- Specified by:
inputFromString
in classAbstractXmlAdapter.EnumIO<T extends java.lang.Enum<T>>
- Parameters:
s
- storage string- Returns:
- enum value.
-
-