Example usage for java.lang Enum name

List of usage examples for java.lang Enum name

Introduction

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

Prototype

String name

To view the source code for java.lang Enum name.

Click Source Link

Document

The name of this enum constant, as declared in the enum declaration.

Usage

From source file:com.prowidesoftware.swift.model.AbstractSwiftMessage.java

/**
 * @see #setProperty(String, String)//from ww  w.j  a v a 2 s  .co m
 */
@SuppressWarnings("rawtypes")
public void setProperty(Enum key, String value) {
    setProperty(key.name(), value);
}

From source file:com.prowidesoftware.swift.model.AbstractSwiftMessage.java

/**
 * @see #getPropertyBoolean(String)//from www.  j a  v  a 2 s.  c  om
 */
@SuppressWarnings("rawtypes")
public boolean getPropertyBoolean(final Enum key) {
    return getPropertyBoolean(key.name());
}

From source file:com.prowidesoftware.swift.model.AbstractSwiftMessage.java

/**
 * Tell if this message has any of the given statuses as <b>current</b> status
 * @param statuses// w  w  w  . j av  a2s.  c  o m
 */
@SuppressWarnings("rawtypes")
public boolean isStatus(Enum... statuses) {
    for (Enum e : statuses) {
        if (e != null && isStatus(e.name())) {
            return true;
        }
    }
    return false;
}

From source file:com.prowidesoftware.swift.model.AbstractSwiftMessage.java

/**
 * Returns true if the current status is equals to the parameter status
 * @param status/*from w ww  . j a  v a 2s .  c o m*/
 */
@SuppressWarnings("rawtypes")
public boolean isStatus(Enum status) {
    if (status != null) {
        return isStatus(status.name());
    } else {
        return false;
    }
}

From source file:com.prowidesoftware.swift.model.AbstractSwiftMessage.java

/**
 * Tell if this message has any of the given statuses in his status <b>trail</b>
 * @param statuses a list of statuses to check in the status trail
 *//*from  w  w w  .  j  av  a 2 s .  com*/
@SuppressWarnings("rawtypes")
public boolean contains(Enum... statuses) {
    boolean result = false;
    List<SwiftMessageStatusInfo> l = getStatusTrail();
    if (l != null && !l.isEmpty()) {
        for (SwiftMessageStatusInfo s : getStatusTrail()) {
            for (Enum e : statuses) {
                if (e != null && StringUtils.equals(s.getName(), e.name())) {
                    result = true;
                }
            }
        }
    }
    return result;
}

From source file:org.eclipse.wb.core.editor.actions.assistant.AbstractAssistantPage.java

/**
 * Creates {@link Group} for choosing one of the enum values for property.
 *///from   w  w  w.j  a va 2  s .  co  m
protected final Group addEnumProperty(Composite parent, String property, String title, String enumClassName) {
    Object[][] titleAndValueArray;
    ClassLoader classLoader = GlobalState.getClassLoader();
    try {
        Class<?> enumClass = classLoader.loadClass(enumClassName);
        if (enumClass.isEnum()) {
            Enum<?>[] constants = (Enum<?>[]) enumClass.getEnumConstants();
            titleAndValueArray = new Object[constants.length][2];
            for (int i = 0; i < constants.length; i++) {
                Enum<?> constantValue = constants[i];
                titleAndValueArray[i][0] = constantValue.name();
                titleAndValueArray[i][1] = constantValue;
            }
        } else {
            titleAndValueArray = new Object[][] { {} };
        }
        return addChoiceProperty(parent, property, title, titleAndValueArray);
    } catch (ClassNotFoundException e) {
        DesignerPlugin.log(e);
        return new Group(parent, SWT.NONE);
    }
}

From source file:de.fiz.ddb.aas.utils.LDAPEngineUtilityOrganisation.java

private boolean checkAttributeEnum(
        //List<Enum<?>> pOrgAtt, List<Enum<?>> pOldOrgAtt, String ldapAttributeName,
        List<ConstEnumOrgSubSector> pOrgAtt, List<ConstEnumOrgSubSector> pOldOrgAtt, String ldapAttributeName,
        Attributes vOrgAttributes, Attributes vOrgRemoveAttributes, boolean isUpdate) {
    boolean hasChanged = false;
    if (!isUpdate) {
        // is create
        if ((pOrgAtt != null) && (!pOrgAtt.isEmpty())) {
            Attribute vAttr = new BasicAttribute(ldapAttributeName);
            for (Enum<?> iterEnum : pOrgAtt) {
                if (iterEnum != null) {
                    vAttr.add(iterEnum.name());
                }/*ww w  .  j a  va 2 s .  c  om*/
            }
            if (vAttr.size() > 0) {
                vOrgAttributes.put(vAttr);
            }
        }
    } else {
        if ((pOrgAtt != null) && (!pOrgAtt.isEmpty())) {
            Attribute vAttr = new BasicAttribute(ldapAttributeName);
            if ((pOrgAtt.isEmpty()) && (pOldOrgAtt != null) && (!pOldOrgAtt.isEmpty())) {
                vOrgRemoveAttributes.put(vAttr);
                hasChanged = true;
            } else {
                for (Enum<?> iterEnum : pOrgAtt) {
                    if (iterEnum != null) {
                        vAttr.add(iterEnum.name());
                    }
                }
                if (vAttr.size() > 0) {
                    vOrgAttributes.put(vAttr);
                    hasChanged = true;
                }
            }
        } else if ((pOrgAtt == null || pOrgAtt.isEmpty()) && (pOldOrgAtt != null && !pOldOrgAtt.isEmpty())) {
            vOrgRemoveAttributes.put(new BasicAttribute(ldapAttributeName));
            hasChanged = true;
        }
    }
    return hasChanged;
}

From source file:net.firejack.platform.model.service.reverse.ReverseEngineeringService.java

private FieldModel createField(String name, Class type, boolean required, EntityModel entityModel) {
    FieldModel fieldModel = new FieldModel();
    fieldModel.setName(StringUtils.uncapitalize(name));
    fieldModel.setPath(entityModel.getLookup());
    fieldModel.setLookup(DiffUtils.lookup(entityModel.getLookup(), name));
    fieldModel.setDisplayName(StringUtils.capitalize(name));
    fieldModel.setRequired(required);//from  w  w  w  .j av a2  s .c om
    fieldModel.setParent(entityModel);

    if (type.isEnum()) {
        Enum[] enumConstants = (Enum[]) type.getEnumConstants();
        fieldModel.setFieldType(LONG_TEXT);
        AllowedFieldValueList valueList = new AllowedFieldValueList();
        for (Enum enumConstant : enumConstants)
            valueList.add(enumConstant.name());
        fieldModel.setAllowedFieldValueList(valueList);
    } else {
        fieldModel.setFieldType(convert(type));
    }

    return fieldModel;
}

From source file:org.jboss.forge.roaster.model.impl.AnnotationImpl.java

@Override
public AnnotationSource<O> setEnumArrayValue(String name, final Enum<?>... values) {
    final List<String> literals = new ArrayList<>();

    for (Enum<?> value : requireNonNull(values)) {
        Import imprt = getOrigin().addImport(requireNonNull(value).getDeclaringClass());
        if (imprt == null) {
            literals.add(value.getDeclaringClass().getCanonicalName() + "." + value.name());
        } else {/*w w  w  . j av a 2 s . c o  m*/
            literals.add(value.getDeclaringClass().getSimpleName() + "." + value.name());
        }
    }
    return setArrayLiteralValue(name, literals);
}