Gets an enum value out of an object.
323459
private Object getEnumValue(Class<?> type, Object value) {
        Object[] enumValues = type.getEnumConstants();
        for (Object enumValue : enumValues) {
            if (enumValue.toString().equals(value.toString())) {
                value = enumValue;
                break;
            }
        }
        return value;
    }
147603
function _enumKeys(it) {
	  var result = _objectKeys(it);
	  var getSymbols = _objectGops.f;
	  if (getSymbols) {
	    var symbols = getSymbols(it);
	    var isEnum = _objectPie.f;
	    var i = 0;
	    var key;
	    while (symbols.length > i) {
	      if (isEnum.call(it, key = symbols[i++])) result.push(key);
	    }
	  }return result;
	}
534437
public <T extends Enum<T>> T getEnum(String name, T defaultValue) {
    final String val = get(name);
    return null == val
             ? defaultValue
             : Enum.valueOf(defaultValue.getDeclaringClass(), val);
  }
478337
public String getString(Enum<?> key, String defaultValue)
    {
        if (key == null)
        {
            return defaultValue;
        }

        return getString(key.name(), defaultValue);
    }
785316
function checkEnums() {
    for (var _i = 0; _i < type.enums.length; _i++) {
      var en = type.enums[_i];

      if (en === value) {
        return {
          name: name,
          value: value,
          strValue: '' + value,
          bypass: propIsBypass
        };
      }
    }

    return null;
  }
104923
protected function castToEnum($key, $value): ?Enum
    {
        $enum = $this->enumCasts[$key];

        if ($value === null || $value instanceOf Enum) {
            return $value;
        } else {
            return $enum::getInstance($value);
        }
    }
365021
def get(key, default=-1):
        """"""
        if isinstance(key, int):
            return TOS_DEL(key)
        if key not in TOS_DEL._member_map_:
            extend_enum(TOS_DEL, key, default)
        return TOS_DEL[key]
811970
def value(self):
        
        if self.isenum():
            if isinstance(self._value, self.enum_ref):
                return self._value.value
            return self._value
        elif self.is_bitmask():
            return self._value.bitmask
        else:
            return self._value
800633
public static <T extends Enum<T>> void enuum(String value, Object object, PropertyInterface property) {
		@SuppressWarnings("unchecked")
		Class<T> enumClass = (Class<T>) property.getClazz();
		List<Enum> values = (List<Enum>) EnumUtils.valueList(enumClass);
		for (Enum enumValue : values) {
			if (enumValue.name().equalsIgnoreCase(value)) {
				property.setValue(object, enumValue);
				return;
			}
		}
		Object createdEnum = InvalidValues.createInvalidEnum(enumClass, value);
		property.setValue(object, createdEnum);
	}
1020597
public static String enumValues(Class<?> enumClass) {
    Preconditions.checkNotNull(enumClass, "enumClass cannot be null");
    Preconditions.checkState(enumClass.isEnum(), "enumClass must be an enum.");
    return Joiner.on(", ").join(enumClass.getEnumConstants());
  }
183402
@SuppressWarnings({ "unchecked", "rawtypes" })
    public Enum<?> findEnumValue(final String enumRef) {
        int sep = enumRef.lastIndexOf('/');
        if (sep == -1) {
            throw new JsiiException("Malformed enum reference: " + enumRef);
        }

        String typeName = enumRef.substring(0, sep);
        String valueName = enumRef.substring(sep + 1);
        try {
            Class klass = resolveJavaClass(typeName);
            return Enum.valueOf(klass, valueName);
        } catch (final ClassNotFoundException e) {
            throw new JsiiException("Unable to resolve enum type " + typeName, e);
        }
    }
1026761
def _handle_enum(self, node, scope, ctxt, stream):
        
        self._dlog("handling enum")
        if node.type is None:
            enum_cls = fields.Int
        else:
            enum_cls = self._handle_node(node.type, scope, ctxt, stream)

        enum_vals = {}
        curr_val = enum_cls()
        curr_val._pfp__value = -1
        for enumerator in node.values.enumerators:
            if enumerator.value is not None:
                curr_val = self._handle_node(enumerator.value, scope, ctxt, stream)
            else:
                curr_val = curr_val + 1
            curr_val._pfp__freeze()
            enum_vals[enumerator.name] = curr_val
            enum_vals[fields.PYVAL(curr_val)] = enumerator.name
            scope.add_local(enumerator.name, curr_val)

        if node.name is not None:
            enum_cls = EnumDef(node.name, enum_cls, enum_vals)
            scope.add_type_class(node.name, enum_cls)

        else:
            enum_cls = EnumDef("enum_" + enum_cls.__name__, enum_cls, enum_vals)
            # don't add to scope if we don't have a name

        return enum_cls
1036489
private static Object _convertOrCoerceValue(FacesContext facesContext,
            UIComponent uiComponent, Object value, SelectItem selectItem,
            Converter converter)
    {
        Object itemValue = selectItem.getValue();
        if (converter != null && itemValue instanceof String)
        {
            itemValue = converter.getAsObject(facesContext, uiComponent,
                    (String) itemValue);
        }
        else
        {
            // The javadoc of UISelectOne/UISelectMany says : 
            // "... Before comparing each option, coerce the option value type
            //  to the type of this component's value following the 
            // Expression Language coercion rules ..."
            // If the coercion fails, just return the value without coerce,
            // because it could be still valid the comparison for that value.
            // and swallow the exception, because its information is no relevant
            // on this context.
            try
            {
                if (value instanceof java.lang.Enum)
                {
                    // Values from an enum are a special case. There is one syntax were the
                    // particular enumeration is extended using something like
                    // SOMEVALUE { ... }, usually to override toString() method. In this case,
                    // value.getClass is not the target enum class, so we need to get the 
                    // right one from super class.
                    Class targetClass = value.getClass();
                    if (targetClass != null && !targetClass.isEnum())
                    {
                        targetClass = targetClass.getSuperclass();
                    }
                    itemValue = _ClassUtils.convertToTypeNoLogging(facesContext, itemValue, targetClass);
                }
                else
                {
                    itemValue = _ClassUtils.convertToTypeNoLogging(facesContext, itemValue, value.getClass());
                }
            }
            catch (IllegalArgumentException e)
            {
                //itemValue = selectItem.getValue();
            }
            catch (Exception e)
            {
                //itemValue = selectItem.getValue();
            }
        }
        return itemValue;
    }
1138945
public static <T extends Enum<T>> T getElementValueEnum(AnnotationMirror anno, CharSequence name, Class<T> t, boolean useDefaults) {
        Symbol.VarSymbol vs = getElementValue(anno, name, Symbol.VarSymbol.class, useDefaults);
        T value = Enum.valueOf(t, vs.getSimpleName().toString());
        return value;
    }
340126
def _load_enums(root):
    """"""
    out = collections.OrderedDict()
    for elem in root.findall('enums/enum'):
        name = elem.attrib['name']
        value = elem.attrib['value']
        comment = elem.get('comment')
        out[name] = Enum(name, value, comment)
    return out
859599
def get_enum_from_name(self, enum_name):
        
        return next((e for e in self.enums if e.name == enum_name), None)
571963
def get_value_name(self, pretty=False):
        
        if pretty:
            return "%s (%x)" % (
                self.enums.get(self._value, "n/a"),
                self._value
            )

        return self.enums.get(self._value, "n/a")