List of usage examples for org.eclipse.jdt.core.dom ITypeBinding isDeprecated
public boolean isDeprecated();
From source file:org.eclipse.xtext.common.types.access.jdt.JdtBasedTypeFactory.java
License:Open Source License
/** * @since 2.4/*from ww w.j a v a 2s .co m*/ */ protected JvmDeclaredType createType(ITypeBinding typeBinding, String handleIdentifier, List<String> path, StringBuilder fqn) { if (typeBinding.isAnonymous() || typeBinding.isSynthetic()) throw new IllegalStateException("Cannot create type for anonymous or synthetic classes"); // Creates the right type of instance based on the type of binding. // JvmGenericType jvmGenericType; JvmDeclaredType result; boolean hasFields; if (typeBinding.isAnnotation()) { jvmGenericType = null; result = TypesFactory.eINSTANCE.createJvmAnnotationType(); hasFields = false; } else if (typeBinding.isEnum()) { jvmGenericType = null; result = TypesFactory.eINSTANCE.createJvmEnumerationType(); hasFields = true; } else { result = jvmGenericType = TypesFactory.eINSTANCE.createJvmGenericType(); jvmGenericType.setInterface(typeBinding.isInterface()); hasFields = true; } // Populate the information computed from the modifiers. // int modifiers = typeBinding.getModifiers(); setTypeModifiers(result, modifiers); result.setDeprecated(typeBinding.isDeprecated()); setVisibility(result, modifiers); // Determine the simple name and compose the fully qualified name and path, remembering the fqn length and path size so we can reset them. // String simpleName = typeBinding.getName(); fqn.append(simpleName); int length = fqn.length(); int size = path.size(); path.add(simpleName); String qualifiedName = fqn.toString(); result.internalSetIdentifier(qualifiedName); result.setSimpleName(simpleName); // Traverse the nested types using '$' as the qualified name separator. // fqn.append('$'); createNestedTypes(typeBinding, result, handleIdentifier, path, fqn); // Traverse the methods using '.'as the qualifed name separator. // fqn.setLength(length); fqn.append('.'); createMethods(typeBinding, handleIdentifier, path, fqn, result); // If there fields allowed, traverse them. // if (hasFields) { createFields(typeBinding, fqn, result); } // Set the super types. // setSuperTypes(typeBinding, qualifiedName, result); // If this is for a generic type, populate the type parameters. // if (jvmGenericType != null) { ITypeBinding[] typeParameterBindings = typeBinding.getTypeParameters(); if (typeParameterBindings.length > 0) { InternalEList<JvmTypeParameter> typeParameters = (InternalEList<JvmTypeParameter>) jvmGenericType .getTypeParameters(); for (ITypeBinding variable : typeParameterBindings) { typeParameters.addUnique(createTypeParameter(variable, result)); } } } // Populate the annotation values. // createAnnotationValues(typeBinding, result); // Restore the path. // path.remove(size); return result; }