/** * Copyright (c) 2003-2006 Uthlande Cooperation. * c/o Blohm + Voss GmbH, Hermann-Blohm-Strasse 3, 20457 Hamburg, Germany * All rights reserved. * * This Software is the confidential and proprietary information of the * Uthlande Cooperation ("Confidential Information") and protected by Copyright * Law. You shall not disclose such Confidential Information to any third party. * The use of the Confidential Information is subject only to the Terms of the * (License) Agreement you entered into with the Uthlande Cooperation. * Any reproduction, publication, distribution or other use of the Software or * parts thereof beyond the Terms of the (License) Agreement with the Uthlande * Cooperation is expressly prohibited and will lead to criminal and private law * prosecution. */ package sample; import org.exolab.castor.mapping.GeneralizedFieldHandler; public class SeverityHandler extends GeneralizedFieldHandler { /** * do the transformation is used for marshalling */ @Override public Object convertUponGet(Object value) { return ((Severity) value).toString(); } /** * do the inverse transformation, is used for unmarshalling */ @Override public Object convertUponSet(Object value) { if (value.equals(Severity.ERROR.toString())) { return Severity.ERROR; } else if (value.equals(Severity.OK.toString())) { return Severity.OK; } return Severity.WARNING; } /* * (non-Javadoc) * * @see org.exolab.castor.mapping.GeneralizedFieldHandler#getFieldType() */ @Override public Class getFieldType() { return Severity.class; } }