Back to project page cirrus.
The source code is released under:
Apache License
If you think the Android project cirrus listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.inktomi.cirrus; //w ww . j a v a 2 s. c o m import org.simpleframework.xml.transform.Transform; /** * Created by mruno on 8/6/13. */ public class EnumTransform implements Transform<Enum> { private final Class type; public EnumTransform(Class type) { this.type = type; } public Enum read(String value) throws Exception { for (Object o : type.getEnumConstants()) { String test = o.toString(); test = test.replaceAll(" ", "_"); if (test.equalsIgnoreCase(value.replaceAll(" ", "_"))) { return (Enum) o; } } return null; } public String write(Enum value) throws Exception { return value.toString(); } }