List of usage examples for java.lang Enum name
String name
To view the source code for java.lang Enum name.
Click Source Link
From source file:Main.java
public static String wrapAttribute(Enum<?> tag, String value) { return " " + tag.name().toLowerCase() + "=\"" + value + "\""; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ }
From source file:Main.java
public static String formatEnumValueForXml(/*@Nullable*/Enum enumValue) { return enumValue == null ? null : enumValue.name().toLowerCase().replace('_', '-'); }
From source file:Main.java
public static String serializedName(Enum anEnum) { String name = anEnum.name(); try {/*www . ja v a 2 s .c o m*/ SerializedName serializedName = anEnum.getClass().getField(name).getAnnotation(SerializedName.class); if (serializedName != null) { name = serializedName.value(); } } catch (NoSuchFieldException ignored) { } return name; }
From source file:Main.java
public static String getXmlName(Enum<?> node) { String name = node.name(); //remove leading or trailing underscore, it is used if a name conflicts with a Java keyword if (name.length() > 0 && name.charAt(0) == '_') { name = name.substring(1);/*from w w w. j a v a2 s . co m*/ } if (name.length() > 0 && name.charAt(name.length() - 1) == '_') { name = name.substring(0, name.length() - 1); } return name.replace('_', '-');//use dashes instead of underscores in XML }
From source file:Main.java
@Nullable public static String formatEnumValueForXml(@Nullable Enum enumValue) { return enumValue == null ? null : enumValue.name().toLowerCase().replace('_', '-'); }
From source file:Main.java
public static boolean is(Enum action, String name) { return action == null || name == null ? false : action.name().equalsIgnoreCase(name); }
From source file:org.infernogames.mb.Utils.StringUtils.java
public static String formatEnum(Enum<?> e) { String name = e.name().toLowerCase().replaceAll("_", " "); String[] arr = name.split(" "); StringBuilder sb = new StringBuilder(); for (int i = 0; i < arr.length; i++) { sb.append(Character.toUpperCase(arr[i].charAt(0))).append(arr[i].substring(1)).append(" "); }// ww w. j av a 2 s.c o m return sb.toString().trim(); }
From source file:com.synopsys.integration.util.EnumUtils.java
public static String prettyPrint(Enum<?> enumValue) { String name = enumValue.name(); String prettyName = WordUtils.capitalizeFully(name.replace("_", " ")); return prettyName; }
From source file:Main.java
/** Read the {@link XmlEnumValue} string off of an enum. */ public static String enumToXml(Enum<?> input) { try {// w w w . ja va 2 s .c om return input.getClass().getField(input.name()).getAnnotation(XmlEnumValue.class).value(); } catch (NoSuchFieldException e) { throw new RuntimeException(e); } }
From source file:com.noxpvp.noxguilds.util.NoxEnumUtil.java
public static String getFriendlyName(Enum<?> e) { return WordUtils.capitalizeFully(e.name().replace("_", " ").toLowerCase()); }