net.sf.mmm.util.xml.base.jaxb
Class XmlAdapterEnum<E extends Enum<E>>

java.lang.Object
  extended by javax.xml.bind.annotation.adapters.XmlAdapter<String,E>
      extended by net.sf.mmm.util.xml.base.jaxb.XmlAdapterEnum<E>
Type Parameters:
E - is the type of the enum.

public abstract class XmlAdapterEnum<E extends Enum<E>>
extends javax.xml.bind.annotation.adapters.XmlAdapter<String,E>

This is an implementation of XmlAdapter for mapping Enums to nice names.

Since:
2.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Constructor Summary
XmlAdapterEnum()
          The constructor.
 
Method Summary
protected abstract  Class<E> getEnumClass()
          This method gets the Class reflecting the enum.
 String marshal(E value)
          
protected  String normalize(String enumName)
          This method normalizes the constant name of the Enum.
 E unmarshal(String value)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlAdapterEnum

public XmlAdapterEnum()
The constructor.

Method Detail

getEnumClass

protected abstract Class<E> getEnumClass()
This method gets the Class reflecting the enum.

Returns:
the enum type.

marshal

public String marshal(E value)
               throws Exception

Specified by:
marshal in class javax.xml.bind.annotation.adapters.XmlAdapter<String,E extends Enum<E>>
Throws:
Exception

normalize

protected String normalize(String enumName)
This method normalizes the constant name of the Enum.

Parameters:
enumName - is the name.
Returns:
the normalized name.

unmarshal

public E unmarshal(String value)
                            throws Exception

Specified by:
unmarshal in class javax.xml.bind.annotation.adapters.XmlAdapter<String,E extends Enum<E>>
Throws:
Exception


Copyright © 2001-2010 mmm-Team. All Rights Reserved.