private enum Key {
TRANSPARENCY("transparecy");
private String stringValue;
Key(String stringValue) {
this.stringValue = stringValue;
}
@Override
public String toString() {
return this.stringValue;
}
public static Key getEnum(String stringValue) {
if (stringValue == null) {
throw new IllegalArgumentException();
}
for (Key key : values()) {
if (stringValue.equalsIgnoreCase(key.toString())) {
return key;
}
}
throw new IllegalArgumentException();
}
}
lunes, 11 de agosto de 2014
Android: "Smart" enum class
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario