protected JvmGenericType transform(XtendClass source, boolean prelinkingPhase) { JvmGenericType inferredJvmType = typesFactory.createJvmGenericType(); source.eResource().getContents().add(inferredJvmType); associator.associatePrimary(source, inferredJvmType); inferredJvmType.setPackageName(source.getPackageName()); inferredJvmType.setSimpleName(source.getName()); inferredJvmType.setVisibility(JvmVisibility.PUBLIC); if (!prelinkingPhase) { JvmAnnotationType annotation = (JvmAnnotationType) typeReferences.findDeclaredType(SuppressWarnings.class, source); if (annotation != null) { JvmAnnotationReference suppressWarnings = typesFactory.createJvmAnnotationReference(); suppressWarnings.setAnnotation(annotation); JvmStringAnnotationValue annotationValue = typesFactory.createJvmStringAnnotationValue(); annotationValue.getValues().add("all"); suppressWarnings.getValues().add(annotationValue); inferredJvmType.getAnnotations().add(suppressWarnings); } addDefaultConstructor(source, inferredJvmType); if (source.getExtends() == null) { JvmTypeReference typeRefToObject = typeReferences.getTypeForName(Object.class, source); if (typeRefToObject != null) inferredJvmType.getSuperTypes().add(typeRefToObject); } else { inferredJvmType.getSuperTypes().add(cloneWithProxies(source.getExtends())); } for (JvmTypeReference intf : source.getImplements()) { inferredJvmType.getSuperTypes().add(cloneWithProxies(intf)); } copyAndFixTypeParameters(source.getTypeParameters(), inferredJvmType); for (XtendMember member : source.getMembers()) { if (member instanceof XtendField || (member instanceof XtendFunction && ((XtendFunction) member).getName() != null) || member instanceof XtendConstructor) { transform(member, inferredJvmType); } } appendSyntheticDispatchMethods(source, inferredJvmType); computeInferredReturnTypes(inferredJvmType); jvmTypesBuilder.translateAnnotationsTo(source.getAnnotations(), inferredJvmType); jvmTypesBuilder.setDocumentation(inferredJvmType, jvmTypesBuilder.getDocumentation(source)); nameClashResolver.resolveNameClashes(inferredJvmType); } return inferredJvmType; }
@Override public boolean createEObjectDescriptions( EObject eObject, IAcceptor<IEObjectDescription> acceptor) { if (eObject instanceof EClass) { QualifiedName name = nameProvider.getFullyQualifiedName(eObject); if (name != null) { URI uri = eObject.eResource().getURI(); EClass eClass = ecoreFactory.createEClass(); proxyTool.installProxyURI(uri, eClass, name); acceptor.accept(EObjectDescription.create(name, eClass)); } return false; } else if (eObject instanceof GenClass) { QualifiedName name = nameProvider.getFullyQualifiedName(eObject); if (name != null) { URI uri = eObject.eResource().getURI(); GenClass genClass = genFactory.createGenClass(); proxyTool.installProxyURI(uri, genClass, name); acceptor.accept(EObjectDescription.create(name, genClass)); } return false; } else if (eObject instanceof GenDataType) { QualifiedName name = nameProvider.getFullyQualifiedName(eObject); if (name != null) { URI uri = eObject.eResource().getURI(); GenDataType genDataType = eObject instanceof GenEnum ? genFactory.createGenEnum() : genFactory.createGenDataType(); proxyTool.installProxyURI(uri, genDataType, name); acceptor.accept(EObjectDescription.create(name, genDataType)); } return false; } else if (eObject instanceof JvmGenericType) { QualifiedName name = nameProvider.getFullyQualifiedName(eObject); if (name != null) { URI uri = eObject.eResource().getURI(); JvmGenericType jvmGenericType = typesFactory.createJvmGenericType(); proxyTool.installProxyURI(uri, jvmGenericType, name); acceptor.accept(EObjectDescription.create(name, jvmGenericType)); } return false; } else if (eObject instanceof JvmEnumerationType) { QualifiedName name = nameProvider.getFullyQualifiedName(eObject); if (name != null) { URI uri = eObject.eResource().getURI(); JvmEnumerationType jvmEnumerationType = typesFactory.createJvmEnumerationType(); proxyTool.installProxyURI(uri, jvmEnumerationType, name); acceptor.accept(EObjectDescription.create(name, jvmEnumerationType)); } return false; } else if (eObject instanceof XAnnotationDirective) { QualifiedName name = nameProvider.getFullyQualifiedName(eObject); if (name != null) { acceptor.accept(EObjectDescription.create(name, eObject)); } return false; } else if (eObject instanceof EPackage) { QualifiedName name = nameProvider.getFullyQualifiedName(eObject); if (name != null) { URI uri = eObject.eResource().getURI(); EPackage ePackage = ecoreFactory.createEPackage(); proxyTool.installProxyURI(uri, ePackage, name); acceptor.accept( EObjectDescription.create(name, ePackage, Collections.singletonMap("nsURI", "true"))); } return true; } else if (eObject instanceof XPackage || eObject instanceof GenModel || eObject instanceof GenPackage) { return true; } else { return false; } }