Search in sources :

Example 6 with CollectionLiteralAnnotationTerm

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

the class AnnotationLoader method readIntegerValuesAnnotation.

private LiteralAnnotationTerm readIntegerValuesAnnotation(AnnotationMirror valueAnnotation, boolean singleValue) {
    if (singleValue) {
        Long value = getAnnotationLongValues(valueAnnotation, "value").get(0);
        IntegerLiteralAnnotationTerm term = new IntegerLiteralAnnotationTerm(value);
        return term;
    } else {
        CollectionLiteralAnnotationTerm result = new CollectionLiteralAnnotationTerm(IntegerLiteralAnnotationTerm.FACTORY);
        for (Long value : getAnnotationLongValues(valueAnnotation, "value")) {
            result.addElement(new IntegerLiteralAnnotationTerm(value));
        }
        return result;
    }
}
Also used : IntegerLiteralAnnotationTerm(com.redhat.ceylon.compiler.java.codegen.IntegerLiteralAnnotationTerm) CollectionLiteralAnnotationTerm(com.redhat.ceylon.compiler.java.codegen.CollectionLiteralAnnotationTerm)

Example 7 with CollectionLiteralAnnotationTerm

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

the class AnnotationLoader method readStringValuesAnnotation.

private LiteralAnnotationTerm readStringValuesAnnotation(AnnotationMirror valueAnnotation, boolean singleValue) {
    if (singleValue) {
        String value = getAnnotationStringValues(valueAnnotation, "value").get(0);
        StringLiteralAnnotationTerm term = new StringLiteralAnnotationTerm(value);
        return term;
    } else {
        CollectionLiteralAnnotationTerm result = new CollectionLiteralAnnotationTerm(StringLiteralAnnotationTerm.FACTORY);
        for (String value : getAnnotationStringValues(valueAnnotation, "value")) {
            result.addElement(new StringLiteralAnnotationTerm(value));
        }
        return result;
    }
}
Also used : StringLiteralAnnotationTerm(com.redhat.ceylon.compiler.java.codegen.StringLiteralAnnotationTerm) CollectionLiteralAnnotationTerm(com.redhat.ceylon.compiler.java.codegen.CollectionLiteralAnnotationTerm)

Aggregations

CollectionLiteralAnnotationTerm (com.redhat.ceylon.compiler.java.codegen.CollectionLiteralAnnotationTerm)7 BooleanLiteralAnnotationTerm (com.redhat.ceylon.compiler.java.codegen.BooleanLiteralAnnotationTerm)1 CharacterLiteralAnnotationTerm (com.redhat.ceylon.compiler.java.codegen.CharacterLiteralAnnotationTerm)1 DeclarationLiteralAnnotationTerm (com.redhat.ceylon.compiler.java.codegen.DeclarationLiteralAnnotationTerm)1 FloatLiteralAnnotationTerm (com.redhat.ceylon.compiler.java.codegen.FloatLiteralAnnotationTerm)1 IntegerLiteralAnnotationTerm (com.redhat.ceylon.compiler.java.codegen.IntegerLiteralAnnotationTerm)1 ObjectLiteralAnnotationTerm (com.redhat.ceylon.compiler.java.codegen.ObjectLiteralAnnotationTerm)1 StringLiteralAnnotationTerm (com.redhat.ceylon.compiler.java.codegen.StringLiteralAnnotationTerm)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