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:org.rhq.core.domain.server.PersistenceUtility.java
@SuppressWarnings("unchecked") // used in hibernate.jsp public static String getDisplayString(Type hibernateType) { if (hibernateType instanceof EntityType) { return hibernateType.getName() + " (enter integer of ID / primary key field)"; } else if (hibernateType instanceof CustomType) { if (Enum.class.isAssignableFrom(hibernateType.getReturnedClass())) { Class<? extends Enum<?>> enumClass = (Class<? extends Enum<?>>) hibernateType.getReturnedClass(); StringBuilder result = new StringBuilder(); result.append(enumClass.getName()); result.append(" ("); boolean first = true; for (Enum<?> nextEnum : enumClass.getEnumConstants()) { if (!first) { result.append(" | "); } else { first = false;/*from w w w . j a v a 2 s . c o m*/ } result.append(nextEnum.name()); } result.append(")"); return result.toString(); } } return hibernateType == null ? "" : hibernateType.getName(); }
From source file:de.xwic.appkit.core.transport.xml.XmlBeanSerializer.java
/** * @param element/* w w w .ja v a 2 s . c o m*/ * @param value */ private static <T extends Enum<T>> void serializeEnum(final Element element, final Enum<T> value) { element.addElement(ELM_ENUM).setText(value.name()); }
From source file:com.opendoorlogistics.core.utils.strings.Strings.java
/** * Converts text to a more-display friendly format. * //from w w w. j av a2 s .c om * @param text * @return */ public static String convertEnumToDisplayFriendly(Enum<?> en) { return convertEnumToDisplayFriendly(en.name()); }
From source file:gdv.xport.feld.Feld.java
/** * Konvertiert einen Bezeichner (in GROSSBUCHSTABEN) in die entsprechende Bezeichnung. * * @param name//from w ww. j av a 2 s .c o m * z.B. HELLO_WORLD (als Aufzaehlungstyp) * @return z.B. "Hello World" */ public static String toBezeichnung(final Enum<?> name) { FeldInfo feldInfo = getFeldInfo(name); if ((feldInfo == null) || StringUtils.isEmpty(feldInfo.bezeichnung())) { return toBezeichnung(name.name()); } else { return feldInfo.bezeichnung(); } }
From source file:me.xiaopan.android.gohttp.requestobject.RequestParser.java
/** * ?Value/* www .j ava2 s .com*/ * @param context * @param enumObject */ public static String parseValueAnnotationFromEnum(Context context, Enum<?> enumObject) { Value annotation = null; try { annotation = enumObject.getClass().getField(enumObject.name()).getAnnotation(Value.class); } catch (Exception e) { e.printStackTrace(); } if (annotation == null) { return null; } String annotationValue = annotation.value(); if (annotationValue != null && !"".equals(annotationValue)) { return annotationValue; } else if (context != null && annotation.resId() > 0) { return context.getString(annotation.resId()); } else { return null; } }
From source file:org.kuali.rice.krad.keyvalues.EnumValuesFinder.java
/** * Derives a key value from an enum */ protected String getEnumKey(Enum enm) { return enm.name(); }
From source file:org.xsystem.bpmn2.formats.xml.EnumConverter.java
@Override public <T> T convert(Class<T> tClass, Object o) { String enumValName = (String) o; Enum[] enumConstants = (Enum[]) tClass.getEnumConstants(); for (Enum enumConstant : enumConstants) { if (enumConstant.name().equals(enumValName)) { return (T) enumConstant; }//from www .j a va2 s . c o m } throw new ConversionException( String.format("Failed to convert %s value to %s class", enumValName, tClass.toString())); }
From source file:org.kuali.rice.krad.keyvalues.EnumValuesFinder.java
/** * Derives a label value from an enum//from w w w . j av a 2 s. com */ protected String getEnumLabel(Enum enm) { return WordUtils.capitalize(enm.name().toLowerCase()); }
From source file:com.greenline.hrs.admin.test.normal.EnumTest.java
@Test public void testType() { Object obj = UserStatus.ACTIVATING; if (obj.getClass().isEnum()) { Enum test = (Enum) obj; LOG.info(test.name()); } else {/*from ww w . java2 s.c o m*/ LOG.info("hello"); } }
From source file:com.senacor.wbs.web.core.EnumConverter.java
public String convertToString(Object value, Locale locale) { Enum enumValue = (Enum) value; String enumName = enumValue.name(); String words = StringUtils.replace(enumName, "_", " "); return WordUtils.capitalizeFully(words); }