本文整理匯總了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;
}
示例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));
}
示例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
}
}
}
}