public JvmTypeReference getExtendedClass(JvmDeclaredType type) { for(JvmTypeReference candidate: type.getSuperTypes()) { JvmType candidateType = candidate.getType(); if (candidateType instanceof JvmGenericType && !((JvmGenericType) candidateType).isInterface()) return candidate; } return null; }
@Override public boolean apply(JvmTypeReference typeReference) { JvmType type = typeReference.getType(); if (type != null && type.eClass() == TypesPackage.Literals.JVM_GENERIC_TYPE) { return ((JvmGenericType) type).isInterface(); } return false; } });
private JvmType getTypeForAnnotationValue(JvmOperation value) { JvmType expectedType = value.getReturnType().getType(); if (expectedType instanceof JvmArrayType) { expectedType = ((JvmArrayType) expectedType).getComponentType(); } return expectedType; }
protected String getDeclaratorName(JvmFeature feature) { JvmDeclaredType declarator = feature.getDeclaringType(); if (declarator.isLocal()) { return "new " + Iterables.getLast(declarator.getSuperTypes()).getType().getSimpleName()+ "(){}"; } else { return declarator.getSimpleName(); } }
public String getSuperTypeName(JvmTypeReference typeReference) { if (typeReference instanceof JvmParameterizedTypeReference) { JvmType rawType = typeReference.getType(); if (rawType != null && !rawType.eIsProxy()) { return rawType.getIdentifier(); } return null; } else { return typeReference.getIdentifier(); } } });
protected boolean isArrayOfAnnotations(final JvmAnnotationValue annotationValue) { final JvmTypeReference returnType = annotationValue.getOperation().getReturnType(); if ((returnType instanceof JvmGenericArrayTypeReference)) { JvmType _type = ((JvmGenericArrayTypeReference)returnType).getComponentType().getType(); return (_type instanceof JvmAnnotationType); } return false; }
public Iterable<String> getEnumValues(final JvmTypeReference reference) { JvmType _type = reference.getType(); final JvmEnumerationType enumType = ((JvmEnumerationType) _type); final Function1<JvmEnumerationLiteral, String> _function = (JvmEnumerationLiteral it) -> { return it.getSimpleName(); }; return ListExtensions.<JvmEnumerationLiteral, String>map(enumType.getLiterals(), _function); }
public boolean apply(JvmTypeReference typeReference) { JvmType type = typeReference.getType(); if (type instanceof JvmGenericType) { return ((JvmGenericType) type).isInterface(); } return false; } });
public static boolean isDeprecated(JvmAnnotationTarget jvmAnnotationTarget) { for (JvmAnnotationReference ref : jvmAnnotationTarget.getAnnotations()) { if (ref != null && !ref.eIsProxy()) { JvmAnnotationType annotation = ref.getAnnotation(); if(annotation != null && !annotation.eIsProxy() && isDeprecated(annotation)) return true; } } return false; }
public void completeJvmConstructor(JvmConstructor constructor) { JvmDeclaredType declaringType = constructor.getDeclaringType(); if(declaringType != null) { String simpleName = declaringType.getSimpleName(); if(simpleName != null) { constructor.setSimpleName(simpleName); return; } } constructor.setSimpleName("unset"); }
protected boolean isClass(JvmType type) { EClass eClass = type.eClass(); if (eClass == TypesPackage.Literals.JVM_ARRAY_TYPE) return isClass(((JvmArrayType) type).getComponentType()); return eClass == TypesPackage.Literals.JVM_GENERIC_TYPE && !((JvmGenericType) type).isInterface(); }
protected String getDeclaratorSimpleName(JvmIdentifiableElement element) { if (element instanceof JvmConstructor) { return null; } if (element instanceof JvmMember) { return ((JvmMember) element).getDeclaringType().getSimpleName(); } return null; }
protected boolean isInner(JvmType type) { if (type != null && type.eClass() == TypesPackage.Literals.JVM_GENERIC_TYPE) { if (type.eContainer() instanceof JvmDeclaredType) { return !((JvmGenericType) type).isStatic(); } } return false; }
private JvmTypeReference createUnknownTypeReference(String name) { JvmUnknownTypeReference reference = TypesFactory.eINSTANCE.createJvmUnknownTypeReference(); reference.setQualifiedName(name); return reference; }
@Override public boolean isAnonymous() { return type.eClass() == TypesPackage.Literals.JVM_GENERIC_TYPE && ((JvmGenericType) type).isAnonymous(); }
public JvmDelegateTypeReference createDelegateTypeReference(JvmTypeReference typeRef) { JvmDelegateTypeReference delegate = factory.createJvmDelegateTypeReference(); delegate.setDelegate(typeRef); return delegate; }
protected String getDeclaratorSimpleName(JvmIdentifiableElement element) { if (element instanceof JvmConstructor) { return null; } if (element instanceof JvmMember) { return ((JvmMember) element).getDeclaringType().getSimpleName(); } return null; }
protected boolean isInner(JvmType type) { if (type.eClass() == TypesPackage.Literals.JVM_GENERIC_TYPE) { if (type.eContainer() instanceof JvmDeclaredType) { return !((JvmGenericType) type).isStatic(); } } return false; }
protected JvmUnknownTypeReference getUnknownTypeReference(String qualifiedName) { JvmUnknownTypeReference reference = TypesFactory.eINSTANCE.createJvmUnknownTypeReference(); reference.setQualifiedName(qualifiedName); return reference; }