Search in sources :

Example 1 with ObjectLiteralAnnotationTerm

use of com.redhat.ceylon.compiler.java.codegen.ObjectLiteralAnnotationTerm in project ceylon-compiler by ceylon.

the class AnnotationLoader method readObjectValuesAnnotation.

private LiteralAnnotationTerm readObjectValuesAnnotation(Module moduleScope, AnnotationMirror valueAnnotation, boolean singleValue) {
    if (singleValue) {
        TypeMirror klass = getAnnotationClassValues(valueAnnotation, "value").get(0);
        Type type = modelLoader.obtainType(moduleScope, klass, null, null, null);
        ObjectLiteralAnnotationTerm term = new ObjectLiteralAnnotationTerm(type);
        return term;
    } else {
        CollectionLiteralAnnotationTerm result = new CollectionLiteralAnnotationTerm(ObjectLiteralAnnotationTerm.FACTORY);
        for (TypeMirror klass : getAnnotationClassValues(valueAnnotation, "value")) {
            Type type = modelLoader.obtainType(moduleScope, klass, null, null, null);
            result.addElement(new ObjectLiteralAnnotationTerm(type));
        }
        return result;
    }
}
Also used : Type(com.redhat.ceylon.model.typechecker.model.Type) DeclarationType(com.redhat.ceylon.model.loader.ModelLoader.DeclarationType) ObjectLiteralAnnotationTerm(com.redhat.ceylon.compiler.java.codegen.ObjectLiteralAnnotationTerm) TypeMirror(com.redhat.ceylon.model.loader.mirror.TypeMirror) CollectionLiteralAnnotationTerm(com.redhat.ceylon.compiler.java.codegen.CollectionLiteralAnnotationTerm)

Aggregations

CollectionLiteralAnnotationTerm (com.redhat.ceylon.compiler.java.codegen.CollectionLiteralAnnotationTerm)1 ObjectLiteralAnnotationTerm (com.redhat.ceylon.compiler.java.codegen.ObjectLiteralAnnotationTerm)1 DeclarationType (com.redhat.ceylon.model.loader.ModelLoader.DeclarationType)1 TypeMirror (com.redhat.ceylon.model.loader.mirror.TypeMirror)1 Type (com.redhat.ceylon.model.typechecker.model.Type)1