Package com.redhat.ceylon.compiler.java.codegen

Examples of com.redhat.ceylon.compiler.java.codegen.AnnotationInvocation


            }
        }
     }

    private void setAnnotationConstructor(LazyMethod method, MethodMirror meth) {
        AnnotationInvocation ai = loadAnnotationInvocation(method, method.classMirror, meth);
        if (ai != null) {
            loadAnnotationConstructorDefaultedParameters(method, meth, ai);
            ai.setConstructorDeclaration(method);
            method.setAnnotationConstructor(ai);
        }
    }
View Full Code Here


    }
   
    private AnnotationInvocation loadAnnotationInvocation(
            LazyMethod method,
            AnnotatedMirror annoInstMirror, MethodMirror meth) {
        AnnotationInvocation ai = null;
        AnnotationMirror annotationInvocationAnnotation = null;
       
        List<AnnotationMirror> annotationTree = getAnnotationArrayValue(annoInstMirror, CEYLON_ANNOTATION_INSTANTIATION_TREE_ANNOTATION, "value");
        if (annotationTree != null
                && !annotationTree.isEmpty()) {
            annotationInvocationAnnotation = annotationTree.get(0);
        } else {
            annotationInvocationAnnotation = annoInstMirror.getAnnotation(CEYLON_ANNOTATION_INSTANTIATION_ANNOTATION);
        }
        //stringValueAnnotation = annoInstMirror.getAnnotation(CEYLON_STRING_VALUE_ANNOTATION);
        if (annotationInvocationAnnotation != null) {
            ai = new AnnotationInvocation();
            setPrimaryFromAnnotationInvocationAnnotation(annotationInvocationAnnotation, ai);
            loadAnnotationInvocationArguments(new ArrayList<AnnotationFieldName>(2), method, ai, annotationInvocationAnnotation, annotationTree, annoInstMirror);
        }
        return ai;
    }
View Full Code Here

            List<AnnotationMirror> annotationTree,
            AnnotatedMirror dpm,
            short code) {
        if (code < 0 && code != Short.MIN_VALUE) {
            AnnotationMirror i = annotationTree.get(-code);
            AnnotationInvocation nested = new AnnotationInvocation();
            setPrimaryFromAnnotationInvocationAnnotation(i, nested);
            loadAnnotationInvocationArguments(path, method, nested, i, annotationTree, dpm);
            InvocationAnnotationTerm term = new InvocationAnnotationTerm();
            term.setInstantiation(nested);
            return term;
View Full Code Here

        ctor.setUnit(iface.getUnit());
       
        ParameterList ctorpl = new ParameterList();
        ctor.addParameterList(ctorpl);
       
        AnnotationInvocation ai = new AnnotationInvocation();
        ai.setConstructorDeclaration(ctor);
        ai.setPrimary(klass);
        ai.setInterop(true);
        ctor.setAnnotationConstructor(ai);
        List<AnnotationArgument> annotationArgs = new ArrayList<AnnotationArgument>();
        for (Declaration member : iface.getMembers()) {
            boolean isValue = member.getName().equals("value");
            if (member instanceof JavaMethod) {
                JavaMethod m = (JavaMethod)member;
               
                ParameterAnnotationTerm term = new ParameterAnnotationTerm();
                AnnotationArgument argument = new AnnotationArgument();
                argument.setTerm(term);
                {
                    Parameter klassParam = new Parameter();
                    Value value = new Value();
                    klassParam.setModel(value);
                    value.setInitializerParameter(klassParam);
                    klassParam.setDeclaration(klass);
                    value.setContainer(klass);
                    value.setScope(klass);
                    value.setName(member.getName());
                    klassParam.setName(member.getName());
                    value.setType(annotationParameterType(iface.getUnit(), m));
                    value.setUnboxed(true);
                    value.setUnit(iface.getUnit());
                    if(isValue)
                        classpl.getParameters().add(0, klassParam);
                    else
                        classpl.getParameters().add(klassParam);
                    argument.setParameter(klassParam);
                    klass.addMember(value);
                }
                {
                    Parameter ctorParam = new Parameter();
                    Value value = new Value();
                    ctorParam.setModel(value);
                    value.setInitializerParameter(ctorParam);
                    ctorParam.setDeclaration(ctor);
                    value.setContainer(klass);
                    value.setScope(klass);
                    ctorParam.setDefaulted(m.isDefaultedAnnotation());
                    value.setName(member.getName());
                    ctorParam.setName(member.getName());
                    value.setType(annotationParameterType(iface.getUnit(), m));
                    value.setUnboxed(true);
                    value.setUnit(iface.getUnit());
                    if(isValue)
                        ctorpl.getParameters().add(0, ctorParam);
                    else
                        ctorpl.getParameters().add(ctorParam);
                    term.setSourceParameter(ctorParam);
                    ctor.addMember(value);
                   
                    AnnotationConstructorParameter acp = new AnnotationConstructorParameter();
                    acp.setParameter(ctorParam);
                    if(isValue)
                        ai.getConstructorParameters().add(0, acp);
                    else
                        ai.getConstructorParameters().add(acp);
                }
                annotationArgs.add(argument);
            }
        }
        ai.getAnnotationArguments().addAll(annotationArgs);
        compiledDeclarations.add(klass);
        compiledDeclarations.add(ctor);
    }
View Full Code Here

TOP

Related Classes of com.redhat.ceylon.compiler.java.codegen.AnnotationInvocation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.