protected void init() { com.redhat.ceylon.compiler.typechecker.model.ClassOrInterface decl = (com.redhat.ceylon.compiler.typechecker.model.ClassOrInterface) producedType.getDeclaration(); this.declaration = (FreeClassOrInterface) Metamodel.getOrCreateMetamodel(decl); java.util.Map< ceylon.language.meta.declaration.TypeParameter, ceylon.language.meta.declaration.OpenType> typeArguments = new LinkedHashMap< ceylon.language.meta.declaration.TypeParameter, ceylon.language.meta.declaration.OpenType>(); Iterator<? extends ceylon.language.meta.declaration.TypeParameter> typeParameters = declaration.getTypeParameterDeclarations().iterator(); Object it; java.util.Map< com.redhat.ceylon.compiler.typechecker.model.TypeParameter, com.redhat.ceylon.compiler.typechecker.model.ProducedType> ptArguments = producedType.getTypeArguments(); while ((it = typeParameters.next()) != finished_.$get()) { com.redhat.ceylon.compiler.java.runtime.metamodel.FreeTypeParameter tp = (com.redhat.ceylon.compiler.java.runtime.metamodel.FreeTypeParameter) it; com.redhat.ceylon.compiler.typechecker.model.TypeParameter tpDecl = (com.redhat.ceylon.compiler.typechecker.model.TypeParameter) tp.declaration; com.redhat.ceylon.compiler.typechecker.model.ProducedType ptArg = ptArguments.get(tpDecl); OpenType ptArgWrapped = Metamodel.getMetamodel(ptArg); typeArguments.put(tp, ptArgWrapped); } this.typeArguments = new InternalMap< ceylon.language.meta.declaration.TypeParameter, ceylon.language.meta.declaration.OpenType>( ceylon.language.meta.declaration.TypeParameter.$TypeDescriptor, ceylon.language.meta.declaration.OpenType.$TypeDescriptor, typeArguments); com.redhat.ceylon.compiler.typechecker.model.ProducedType superType = decl.getExtendedType(); if (superType != null) { com.redhat.ceylon.compiler.typechecker.model.ProducedType superTypeResolved = superType.substitute(producedType.getTypeArguments()); this.superclass = (ceylon.language.meta.declaration.OpenClassType) Metamodel.getMetamodel(superTypeResolved); } List<com.redhat.ceylon.compiler.typechecker.model.ProducedType> satisfiedTypes = decl.getSatisfiedTypes(); ceylon.language.meta.declaration.OpenInterfaceType[] interfaces = new ceylon.language.meta.declaration.OpenInterfaceType[satisfiedTypes.size()]; int i = 0; for (com.redhat.ceylon.compiler.typechecker.model.ProducedType pt : satisfiedTypes) { com.redhat.ceylon.compiler.typechecker.model.ProducedType resolvedPt = pt.substitute(producedType.getTypeArguments()); interfaces[i++] = (ceylon.language.meta.declaration.OpenInterfaceType) Metamodel.getMetamodel(resolvedPt); } this.interfaces = Util.sequentialInstance( ceylon.language.meta.declaration.OpenInterfaceType.$TypeDescriptor, interfaces); }
@SuppressWarnings("unchecked") @Override public Value<? extends Get, ? super Set> bind( @TypeInfo("ceylon.language::Object") @Name("container") java.lang.Object container) { return (Value<? extends Get, ? super Set>) Metamodel.bind(this, this.typedReference.getQualifyingType(), container); }
protected void checkInit() { if (!initialised) { synchronized (Metamodel.getLock()) { if (!initialised) { init(); initialised = true; } } } }
@Override public String toString() { String prefix = ""; if (declaration instanceof ceylon.language.meta.declaration.ClassDeclaration) prefix = "class "; else if (declaration instanceof ceylon.language.meta.declaration.InterfaceDeclaration) prefix = "interface "; else if (declaration instanceof ceylon.language.meta.declaration.AliasDeclaration) prefix = "alias "; return prefix + Metamodel.toTypeString(getDeclaration(), getTypeArguments()); }
public AppliedAttribute( @Ignore TypeDescriptor $reifiedContainer, @Ignore TypeDescriptor $reifiedGet, @Ignore TypeDescriptor $reifiedSet, FreeValue declaration, ProducedTypedReference typedReference, ceylon.language.meta.model.Type<? extends Object> container) { super( $reifiedContainer, TypeDescriptor.klass(ceylon.language.meta.model.Value.class, $reifiedGet, $reifiedSet), container); this.declaration = declaration; this.typedReference = typedReference; this.closedType = Metamodel.getAppliedMetamodel(typedReference.getType()); this.$reifiedGet = $reifiedGet; this.$reifiedSet = $reifiedSet; }
// FIXME deal with interfaces/implementations public final void addFrom(final IJavaElement scope, final SubProgressMonitor progressMonitor) throws CoreException { progressMonitor.beginTask("Adding resources and resourceMethods", 1); HTTPMethods httpMethods = metamodel.getHttpMethods(); List<IType> javaTypes = JAXRSAnnotationsScanner.findResources(scope, httpMethods.getTypeNames(), progressMonitor); for (IType javaType : javaTypes) { try { resources.put( javaType.getFullyQualifiedName(), new Resource(javaType, metamodel, progressMonitor)); } catch (InvalidModelElementException e) { Logger.warn( "Type '" + javaType.getFullyQualifiedName() + "' is not a valid JAX-RS Resource: " + e.getMessage()); } } }
@Override public String toString() { return Metamodel.toTypeString(this); }