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


Java Type.toString方法代碼示例

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


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

示例1: createFieldInfos

import org.eclipse.jdt.core.dom.Type; //導入方法依賴的package包/類
private List<FieldInfo> createFieldInfos(FieldDeclaration node, String belongTo) {
    List<FieldInfo> fieldInfos = new ArrayList<>();
    Type type = node.getType();
    Set<String> types = getTypes(type);
    String typeString = type.toString();
    String visibility = getVisibility(node);
    boolean isStatic = isStatic(node);
    boolean isFinal = isFinal(node);
    String comment = "";
    if (node.getJavadoc() != null)
        comment = sourceContent.substring(node.getJavadoc().getStartPosition(), node.getJavadoc().getStartPosition() + node.getJavadoc().getLength());
    List<VariableDeclarationFragment> fragments = node.fragments();
    for (VariableDeclarationFragment fragment : fragments) {
        FieldInfo fieldInfo = new FieldInfo();
        fieldInfo.belongTo = belongTo;
        fieldInfo.name = fragment.getName().getFullyQualifiedName();
        fieldInfo.typeString = typeString;
        fieldInfo.types = types;
        fieldInfo.visibility = visibility;
        fieldInfo.isFinal = isFinal;
        fieldInfo.isStatic = isStatic;
        fieldInfo.comment = comment;
        fieldInfos.add(fieldInfo);
    }
    return fieldInfos;
}
 
開發者ID:linzeqipku,項目名稱:SnowGraph,代碼行數:27,代碼來源:JavaASTVisitor.java

示例2: TypeVariable

import org.eclipse.jdt.core.dom.Type; //導入方法依賴的package包/類
public TypeVariable(Type type) {
  super(type.resolveBinding());
  fSource = type.toString();
  ICompilationUnit cu = ASTCreator.getCu(type);
  Assert.isNotNull(cu);
  fTypeRange = new CompilationUnitRange(cu, ASTNodes.getElementType(type));
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:8,代碼來源:TypeVariable.java

示例3: traverseMethodReturn

import org.eclipse.jdt.core.dom.Type; //導入方法依賴的package包/類
private void traverseMethodReturn(MethodDeclaration methodDeclaration) throws IOException {
	Type returnType2 = methodDeclaration.getReturnType2();
	if (returnType2 != null) {
		ITypeBinding resolveBinding = returnType2.resolveBinding();
		noMethods++;
		if (resolveBinding.getName().equals("void")) noVoidReturnTypes++;
		if (hasAnnotation(methodDeclaration.modifiers()) && !resolveBinding.isPrimitive()) {

			SingleMemberAnnotation annotation = getAnnotation(methodDeclaration.modifiers());
			Expression value = annotation.getValue();
			if (value instanceof StringLiteral) { //@Domain("D")
				StringLiteral annotValue = (StringLiteral)value;
				String parserInput = annotValue.getLiteralValue();
				AnnotationInfo annotInfo = AnnotationInfo.parseAnnotation(parserInput); 
				DomainParams annot = annotInfo.getAnnotation();	

				boolean isDom = isDomain(methodDeclaration.resolveBinding().getDeclaringClass(), annot);
				boolean isDomPars = isDomainParams(methodDeclaration.resolveBinding().getDeclaringClass(), annot);


				ObjectMetricItem archMetricItem = new ObjectMetricItem(methodDeclaration.resolveBinding().getKey(),
						methodDeclaration.getName().getFullyQualifiedName(),
						resolveBinding.getQualifiedName(),
						parserInput,
						methodDeclaration.resolveBinding().getDeclaringClass().getQualifiedName(),
						returnType2.toString(),
						Modifier.isStatic(methodDeclaration.getModifiers()),
						"ReturnType",
						returnType2.resolveBinding().isArray(),
						returnType2.resolveBinding().isEnum(),
						returnType2.resolveBinding().isParameterizedType(),
						isDom,
						isDomPars,
						annot.isObjectPublicDomain());
				if (!objectsHashtable.containsKey(archMetricItem.toString())) {
					objectsHashtable.put(archMetricItem.toString(), archMetricItem);
				}
				// TODO: src.triplets for MethodReturn type					
			}
		}
	}
}
 
開發者ID:aroog,項目名稱:code,代碼行數:43,代碼來源:AnnotatMetrics.java


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