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


Java ITypeBinding.getDeclaredFields方法代碼示例

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


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

示例1: findFieldInType

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
/**
 * Finds the field specified by <code>fieldName</code> in
 * the given <code>type</code>. Returns <code>null</code> if no such field exists.
 * @param type the type to search the field in
 * @param fieldName the field name
 * @return the binding representing the field or <code>null</code>
 */
public static IVariableBinding findFieldInType(ITypeBinding type, String fieldName) {
	if (type.isPrimitive()) {
		return null;
	}
	IVariableBinding[] fields= type.getDeclaredFields();
	for (int i= 0; i < fields.length; i++) {
		IVariableBinding field= fields[i];
		if (field.getName().equals(fieldName)) {
			return field;
		}
	}
	return null;
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:21,代碼來源:Bindings.java

示例2: hasMethodWithName

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
private static boolean hasMethodWithName(ITypeBinding typeBinding, String name) {
	IVariableBinding[] fields= typeBinding.getDeclaredFields();
	for (int i= 0; i < fields.length; i++) {
		if (fields[i].getName().equals(name)) {
			return true;
		}
	}
	ITypeBinding superclass= typeBinding.getSuperclass();
	if (superclass != null) {
		return hasMethodWithName(superclass, name);
	}
	return false;
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:14,代碼來源:UnresolvedElementsSubProcessor.java

示例3: getDeclaredFields

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
public static List<ast.FieldDeclaration> getDeclaredFields(ITypeBinding typeBinding) {
	List<ast.FieldDeclaration> fieldList = new ArrayList<ast.FieldDeclaration>();
	
	for(IVariableBinding fieldDecl: typeBinding.getDeclaredFields()){
		fieldList.add(getFieldDeclaration(fieldDecl));
	}
	return fieldList;
}
 
開發者ID:aroog,項目名稱:code,代碼行數:9,代碼來源:TraceabilityFactory.java


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