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


Java ITypeBinding.getName方法代碼示例

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


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

示例1: isIntegerType

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
private static boolean isIntegerType(ITypeBinding binding) {
	if (binding == null) {
		return false;
	}

	if (!binding.isPrimitive()) {
		return false;
	}

	String name= binding.getName();
	if (isIntegerNumber(name)) {
		return true;
	}

	return false;
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:17,代碼來源:NecessaryParenthesesChecker.java

示例2: getSimpleName

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
private static String getSimpleName(ITypeBinding itb) {
	if (itb.isNested()) {
		if (itb.isAnonymous()) {
			String binname = itb.getBinaryName();
			int index = binname.indexOf('$');
			String name = binname.substring(index + 1, binname.length());
			return getSimpleName(itb.getDeclaringClass()) + "#" + name;
		} else {
			return getSimpleName(itb.getDeclaringClass()) + "#"
					+ itb.getName();
		}
	} else {
		return itb.getName();
	}
}
 
開發者ID:aserg-ufmg,項目名稱:RefDiff,代碼行數:16,代碼來源:ASTVisitorAtomicChange.java

示例3: getRawName

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
public static String getRawName(ITypeBinding binding) {
	String name= binding.getName();
	if (binding.isParameterizedType() || binding.isGenericType()) {
		int idx= name.indexOf('<');
		if (idx != -1) {
			return name.substring(0, idx);
		}
	}
	return name;
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:11,代碼來源:Bindings.java

示例4: newDefaultExpression

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
/**
 * Returns an expression that is assignable to the given type binding. <code>null</code> is
 * returned if the type is the 'void' type.
 *
 * @param ast The AST to create the expression for
 * @param type The type binding to which the returned expression is compatible to
 * @return the Null-literal for reference types, a boolean-literal for a boolean type, a number
 * literal for primitive types or <code>null</code> if the type is void.
 */
public static Expression newDefaultExpression(AST ast, ITypeBinding type) {
	if (type.isPrimitive()) {
		String name= type.getName();
		if ("boolean".equals(name)) { //$NON-NLS-1$
			return ast.newBooleanLiteral(false);
		} else if ("void".equals(name)) { //$NON-NLS-1$
			return null;
		} else {
			return ast.newNumberLiteral("0"); //$NON-NLS-1$
		}
	}
	return ast.newNullLiteral();
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:23,代碼來源:ASTNodeFactory.java

示例5: getVariableNameSuggestions

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
public static String[] getVariableNameSuggestions(int variableKind, IJavaProject project, ITypeBinding expectedType, Expression assignedExpression, Collection<String> excluded) {
	LinkedHashSet<String> res= new LinkedHashSet<>(); // avoid duplicates but keep order

	if (assignedExpression != null) {
		String nameFromExpression= getBaseNameFromExpression(project, assignedExpression, variableKind);
		if (nameFromExpression != null) {
			add(getVariableNameSuggestions(variableKind, project, nameFromExpression, 0, excluded, false), res); // pass 0 as dimension, base name already contains plural.
		}

		String nameFromParent= getBaseNameFromLocationInParent(assignedExpression);
		if (nameFromParent != null) {
			add(getVariableNameSuggestions(variableKind, project, nameFromParent, 0, excluded, false), res); // pass 0 as dimension, base name already contains plural.
		}
	}
	if (expectedType != null) {
		expectedType= Bindings.normalizeTypeBinding(expectedType);
		if (expectedType != null) {
			int dim= 0;
			if (expectedType.isArray()) {
				dim= expectedType.getDimensions();
				expectedType= expectedType.getElementType();
			}
			if (expectedType.isParameterizedType()) {
				expectedType= expectedType.getTypeDeclaration();
			}
			String typeName= expectedType.getName();
			if (typeName.length() > 0) {
				add(getVariableNameSuggestions(variableKind, project, typeName, dim, excluded, false), res);
			}
		}
	}
	if (res.isEmpty()) {
		return getDefaultVariableNameSuggestions(variableKind, excluded);
	}
	return res.toArray(new String[res.size()]);
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:37,代碼來源:StubUtility.java


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