Example usage for java.lang Enum toString

List of usage examples for java.lang Enum toString

Introduction

In this page you can find the example usage for java.lang Enum toString.

Prototype

public String toString() 

Source Link

Document

Returns the name of this enum constant, as contained in the declaration.

Usage

From source file:Main.java

public static Element appendNewElement(Document document, Element parent, Enum el) {
    return appendNewElement(document, parent, el.toString());
}

From source file:Main.java

public static Element appendNewElementIfNotNull(Document document, Element parent, Enum el, Object content,
        String namespace) {/*from   ww  w . ja v  a2s.c  o  m*/
    return appendNewElementIfNotNull(document, parent, el.toString(), content, namespace);
}

From source file:biz.ganttproject.impex.csv.GanttCSVOpen.java

static Collection<String> getFieldNames(Enum... fieldsEnum) {
    return Collections2.transform(Arrays.asList(fieldsEnum), new Function<Enum, String>() {
        @Override/* w  ww  .ja v  a 2 s . c  om*/
        public String apply(Enum input) {
            return input.toString();
        }
    });
}

From source file:com.spectralogic.ds3contractcomparator.print.utils.SimplePrinterUtils.java

/**
 * Prints a line denoting that the specified value exists in the
 * newer contract but not in the older contract. The value "N/A" is
 * used to denote the absence of the value in the older contract column.
 * @param label The label denoting what category is being printed
 * @param newVal The added value/*from w  ww.j  a  v a  2  s  .  c  o m*/
 */
public static void printAddedLine(final String label, final Enum<?> newVal, final int indent,
        final WriterHelper writer) {
    printAddedLine(label, newVal != null ? newVal.toString() : "", indent, writer);
}

From source file:com.spectralogic.ds3contractcomparator.print.utils.SimplePrinterUtils.java

/**
 * Prints a line denoting that the specified value existed in the
 * older contract but not in the newer contract. The value "N/A" is
 * used to denote the absence of the value in the newer contract column.
 * @param label The label denoting what category is being printed
 * @param oldVal The deleted value//from  w  ww .j  a  va 2 s.c om
 */
public static void printDeletedLine(final String label, final Enum<?> oldVal, final int indent,
        final WriterHelper writer) {
    printDeletedLine(label, oldVal != null ? oldVal.toString() : "", indent, writer);
}

From source file:com.spectralogic.ds3contractcomparator.print.utils.SimplePrinterUtils.java

/**
 * Prints a line denoting the value of an element within two versions
 * of a contract. If the value changed between versions, then an arrow
 * is printed between the older version to the newer version. If both
 * values are either empty or null, then the item is not printed.
 * @param label The label denoting what category is being printed
 * @param oldVal The older contract version of the value
 * @param newVal The newer contract version fo the value
 *//*from   w ww. j  a  va 2  s .  co m*/
public static void printModifiedLine(final String label, final Enum<?> oldVal, final Enum<?> newVal,
        final int indent, final WriterHelper writer) {
    printModifiedLine(label, oldVal != null ? oldVal.toString() : "", newVal != null ? newVal.toString() : "",
            indent, writer);
}

From source file:net.sourceforge.ganttproject.io.GanttCSVOpen.java

private static Collection<String> getFieldNames(Enum[] fieldsEnum) {
    return Collections2.transform(Arrays.asList(fieldsEnum), new Function<Enum, String>() {
        @Override//from  ww w . ja  v  a 2 s  . c o m
        public String apply(Enum input) {
            return input.toString();
        }
    });
}

From source file:com.oembedler.moon.graphql.engine.dfs.ResolvableTypeAccessor.java

public static ResolvableTypeAccessor forEnumField(Enum en) {
    Field field = ReflectionUtils.findField(en.getClass(), ((Enum) en).name());
    return new ResolvableTypeAccessor(en.toString(), null, Lists.newArrayList(field.getAnnotations()),
            en.getClass());/* w  ww  .  j a v  a  2 s.c  o m*/
}

From source file:com.qpark.eip.core.ToString.java

private static String toString(final String name, final Enum<?> o) {
    StringBuffer sb = new StringBuffer(4098);
    sb.append(outName(name, o));/*from   w  ww.ja v  a 2  s  .  com*/
    sb.append(o.toString());
    return sb.toString();
}

From source file:org.hdiv.web.servlet.tags.form.SelectedValueComparatorHDIV.java

private static boolean exhaustiveCompare(Object boundValue, Object candidate, PropertyEditor editor,
        Map<PropertyEditor, Object> convertedValueCache) {

    String candidateDisplayString = ValueFormatterHDIV.getDisplayString(candidate, editor, false);
    if (boundValue instanceof LabeledEnum) {
        LabeledEnum labeledEnum = (LabeledEnum) boundValue;
        String enumCodeAsString = ObjectUtils.getDisplayString(labeledEnum.getCode());
        if (enumCodeAsString.equals(candidateDisplayString)) {
            return true;
        }/*from   w  ww .j a v  a 2s .co m*/
        String enumLabelAsString = ObjectUtils.getDisplayString(labeledEnum.getLabel());
        if (enumLabelAsString.equals(candidateDisplayString)) {
            return true;
        }
    } else if (boundValue.getClass().isEnum()) {
        Enum boundEnum = (Enum) boundValue;
        String enumCodeAsString = ObjectUtils.getDisplayString(boundEnum.name());
        if (enumCodeAsString.equals(candidateDisplayString)) {
            return true;
        }
        String enumLabelAsString = ObjectUtils.getDisplayString(boundEnum.toString());
        if (enumLabelAsString.equals(candidateDisplayString)) {
            return true;
        }
    } else if (ObjectUtils.getDisplayString(boundValue).equals(candidateDisplayString)) {
        return true;
    } else if (editor != null && candidate instanceof String) {
        // Try PE-based comparison (PE should *not* be allowed to escape creating thread)
        String candidateAsString = (String) candidate;
        Object candidateAsValue;
        if (convertedValueCache != null && convertedValueCache.containsKey(editor)) {
            candidateAsValue = convertedValueCache.get(editor);
        } else {
            editor.setAsText(candidateAsString);
            candidateAsValue = editor.getValue();
            if (convertedValueCache != null) {
                convertedValueCache.put(editor, candidateAsValue);
            }
        }
        if (ObjectUtils.nullSafeEquals(boundValue, candidateAsValue)) {
            return true;
        }
    }
    return false;
}