當前位置: 首頁>>代碼示例>>Java>>正文


Java Field.isEnumConstant方法代碼示例

本文整理匯總了Java中java.lang.reflect.Field.isEnumConstant方法的典型用法代碼示例。如果您正苦於以下問題:Java Field.isEnumConstant方法的具體用法?Java Field.isEnumConstant怎麽用?Java Field.isEnumConstant使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.lang.reflect.Field的用法示例。


在下文中一共展示了Field.isEnumConstant方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getCanSerializeField

import java.lang.reflect.Field; //導入方法依賴的package包/類
public static Field[] getCanSerializeField(Class<?> clazz) {
	Field[] fields = clazz.getDeclaredFields();
	List<Field> canSerializeFields = new ArrayList<Field>();
	for (Field field : fields) {
		if (field.getName().equals("__PARANAMER_DATA")) {
			continue;
		}
		if (field.isEnumConstant()) {
			continue;
		}
		if (field.getType() == Date.class) {
			continue;
		}
		if ((field.getModifiers() & Modifier.FINAL) == Modifier.FINAL) {
			continue;
		}
		canSerializeFields.add(field);
	}
	Field[] newFields = new Field[canSerializeFields.size()];
	return canSerializeFields.toArray(newFields);
}
 
開發者ID:funtl,項目名稱:framework,代碼行數:22,代碼來源:CommonUtils.java

示例2: computeDocMap

import java.lang.reflect.Field; //導入方法依賴的package包/類
/**
 * Computes a mapping from syntax documentation lines to associated (possibly {@code null}) tooltips.
 * @param logic the logic variant concerned
 */
private static Map<String,String> computeDocMap(Logic logic) {
    Map<String,String> result = new LinkedHashMap<>();
    for (Field field : LogicOp.class.getFields()) {
        if (field.isEnumConstant()) {
            LogicOp token = nameToTokenMap.get(field.getName());
            if (logic.getOps()
                .contains(token)) {
                Help help = Help.createHelp(field, nameToSymbolMap);
                if (help != null) {
                    result.put(help.getItem(), help.getTip());
                }
            }
        }
    }
    return result;
}
 
開發者ID:meteoorkip,項目名稱:JavaGraph,代碼行數:21,代碼來源:FormulaParser.java

示例3: registerField

import java.lang.reflect.Field; //導入方法依賴的package包/類
private void registerField(Map<String, Getter> getters, Map<String, Setter> setters, Field field) {
    if(Modifier.isTransient(field.getModifiers()) ||
       Modifier.isStatic(field.getModifiers()) ||
       field.isSynthetic() ||
       field.isEnumConstant()) return;

    final String name = serializedName(field);
    final boolean gettable = !getters.containsKey(name);
    final boolean settable = !setters.containsKey(name);

    if(gettable || settable) {
        if(logger.isLoggable(Level.FINE)) {
            String access;
            if(gettable && settable) {
                access = "get/set";
            } else if(gettable) {
                access = "get";
            } else {
                access = "set";
            }
            logger.fine("  " + name + " -- " + access + " --> " + field);
        }

        if(gettable) {
            getters.put(name, new FieldGetter(this, field));
        }

        if(settable) {
            setters.put(name, new FieldSetter(this, field));
        }
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:33,代碼來源:DocumentRegistry.java

示例4: createEnumList

import java.lang.reflect.Field; //導入方法依賴的package包/類
/**
 * Creates the enum list.
 *
 * @param pEnumClass the enum class
 */
public void createEnumList(Class<?> pEnumClass) {
    // If the data source already exists, do nothing
    AsListIf<?> tDictionary = (AsListIf<?>) getDataSource(CwfGlobalDataSources.DICTIONARY, null, null);
    if (tDictionary == null) {
        AsLoggerIf.Singleton.get().log("Attempting to register enum " + pEnumClass +
            " before the dictionary exists");
        return;
    }

    if (getDataSource(As.getTypeName(pEnumClass), null, null) != null) {
        return;
    }

    AsEmapiTreeMapList<AsEnumValueData> tList = new AsEmapiTreeMapList<AsEnumValueData>(
        As.getTypeName(pEnumClass), AsEnumValueData.class, ATTR_ENUM_NAME, ATTR_ENUM_VALUE);

    try {
        for (Field tField : pEnumClass.getFields()) {
            if (tField.isEnumConstant()) {
                String tValue = tField.get(null).toString();
                String tName = tField.getName();
                AsDictionaryWord tTranslation = (AsDictionaryWord) tDictionary.get(
                    ".enum." + As.getTypeName(pEnumClass) + "." + tName);
                if (tTranslation == null) {
                    tTranslation = (AsDictionaryWord) tDictionary.get(".enum." + tName);
                }
                AsEnumValueData tEnumData = new AsEnumValueData(
                    As.getTypeName(pEnumClass), tName, tValue, tTranslation);
                tList.add(tEnumData);
            }
        }
    }
    catch (Exception e) {
        // Fatal, abort
        As.systemExit("Could not create constant group list", e);
    }

    putDataSource(tList);
}
 
開發者ID:cinnober,項目名稱:ciguan,代碼行數:45,代碼來源:AsGlobalDataSources.java

示例5: processTypes

import java.lang.reflect.Field; //導入方法依賴的package包/類
private void processTypes(final Set<Class<?>> types) {
    while (!types.isEmpty()) {
        final Iterator<Class<?>> iter = types.iterator();
        final Class<?> type = iter.next();
        iter.remove();

        synchronized (type) {
            if (annotatedTypes.contains(type)) {
                continue;
            }
            try {
                if (type.isPrimitive()) {
                    continue;
                }

                addParametrizedTypes(type, types);

                processConverterAnnotations(type);
                processAliasAnnotation(type, types);
                processAliasTypeAnnotation(type);

                if (type.isInterface()) {
                    continue;
                }

                final Field[] fields = type.getDeclaredFields();
                for (final Field field : fields) {
                    if (field.isEnumConstant()
                        || (field.getModifiers() & (Modifier.STATIC | Modifier.TRANSIENT)) > 0) {
                        continue;
                    }

                    addParametrizedTypes(field.getGenericType(), types);

                    if (field.isSynthetic()) {
                        continue;
                    }

                    processFieldAliasAnnotation(field);
                    processAsAttributeAnnotation(field);
                    processImplicitAnnotation(field);
                    processOmitFieldAnnotation(field);
                    processLocalConverterAnnotation(field);
                }
            } finally {
                annotatedTypes.add(type);
            }
        }
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:51,代碼來源:AnnotationMapper.java


注:本文中的java.lang.reflect.Field.isEnumConstant方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。