Search in sources :

Example 1 with CollectionLiteralAnnotationTerm

use of org.eclipse.ceylon.compiler.java.codegen.CollectionLiteralAnnotationTerm in project ceylon by eclipse.

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(org.eclipse.ceylon.compiler.java.codegen.StringLiteralAnnotationTerm) CollectionLiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.CollectionLiteralAnnotationTerm)

Example 2 with CollectionLiteralAnnotationTerm

use of org.eclipse.ceylon.compiler.java.codegen.CollectionLiteralAnnotationTerm in project ceylon by eclipse.

the class AnnotationLoader method readBooleanValuesAnnotation.

private LiteralAnnotationTerm readBooleanValuesAnnotation(AnnotationMirror valueAnnotation, boolean singleValue) {
    if (singleValue) {
        boolean value = getAnnotationBooleanValues(valueAnnotation, "value").get(0);
        BooleanLiteralAnnotationTerm term = new BooleanLiteralAnnotationTerm(value);
        return term;
    } else {
        CollectionLiteralAnnotationTerm result = new CollectionLiteralAnnotationTerm(BooleanLiteralAnnotationTerm.FACTORY);
        for (Boolean value : getAnnotationBooleanValues(valueAnnotation, "value")) {
            result.addElement(new BooleanLiteralAnnotationTerm(value));
        }
        return result;
    }
}
Also used : BooleanLiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.BooleanLiteralAnnotationTerm) CollectionLiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.CollectionLiteralAnnotationTerm)

Example 3 with CollectionLiteralAnnotationTerm

use of org.eclipse.ceylon.compiler.java.codegen.CollectionLiteralAnnotationTerm in project ceylon by eclipse.

the class AnnotationLoader method readCharacterValuesAnnotation.

private LiteralAnnotationTerm readCharacterValuesAnnotation(AnnotationMirror valueAnnotation, boolean singleValue) {
    if (singleValue) {
        Integer value = getAnnotationIntegerValues(valueAnnotation, "value").get(0);
        CharacterLiteralAnnotationTerm term = new CharacterLiteralAnnotationTerm(value);
        return term;
    } else {
        CollectionLiteralAnnotationTerm result = new CollectionLiteralAnnotationTerm(CharacterLiteralAnnotationTerm.FACTORY);
        for (Integer value : getAnnotationIntegerValues(valueAnnotation, "value")) {
            result.addElement(new CharacterLiteralAnnotationTerm(value));
        }
        return result;
    }
}
Also used : CharacterLiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.CharacterLiteralAnnotationTerm) CollectionLiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.CollectionLiteralAnnotationTerm)

Example 4 with CollectionLiteralAnnotationTerm

use of org.eclipse.ceylon.compiler.java.codegen.CollectionLiteralAnnotationTerm in project ceylon by eclipse.

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(org.eclipse.ceylon.compiler.java.codegen.IntegerLiteralAnnotationTerm) CollectionLiteralAnnotationTerm(org.eclipse.ceylon.compiler.java.codegen.CollectionLiteralAnnotationTerm)

Example 5 with CollectionLiteralAnnotationTerm

use of org.eclipse.ceylon.compiler.java.codegen.CollectionLiteralAnnotationTerm in project ceylon by eclipse.

the class AnnotationLoader method readDeclarationValuesAnnotation.

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

Aggregations

CollectionLiteralAnnotationTerm (org.eclipse.ceylon.compiler.java.codegen.CollectionLiteralAnnotationTerm)7 BooleanLiteralAnnotationTerm (org.eclipse.ceylon.compiler.java.codegen.BooleanLiteralAnnotationTerm)1 CharacterLiteralAnnotationTerm (org.eclipse.ceylon.compiler.java.codegen.CharacterLiteralAnnotationTerm)1 DeclarationLiteralAnnotationTerm (org.eclipse.ceylon.compiler.java.codegen.DeclarationLiteralAnnotationTerm)1 FloatLiteralAnnotationTerm (org.eclipse.ceylon.compiler.java.codegen.FloatLiteralAnnotationTerm)1 IntegerLiteralAnnotationTerm (org.eclipse.ceylon.compiler.java.codegen.IntegerLiteralAnnotationTerm)1 ObjectLiteralAnnotationTerm (org.eclipse.ceylon.compiler.java.codegen.ObjectLiteralAnnotationTerm)1 StringLiteralAnnotationTerm (org.eclipse.ceylon.compiler.java.codegen.StringLiteralAnnotationTerm)1 DeclarationType (org.eclipse.ceylon.model.loader.ModelLoader.DeclarationType)1 TypeMirror (org.eclipse.ceylon.model.loader.mirror.TypeMirror)1 Type (org.eclipse.ceylon.model.typechecker.model.Type)1