Package com.gwtplatform.mvp.client.annotations

Examples of com.gwtplatform.mvp.client.annotations.NameToken


    private void handleSubsystemElement(Element element) {
        List<? extends AnnotationMirror> annotationMirrors = element.getAnnotationMirrors();
        for (AnnotationMirror mirror : annotationMirrors) {
            final String annotationType = mirror.getAnnotationType().toString();
            if (annotationType.equals(SubsystemExtension.class.getName())) {
                NameToken nameToken = element.getAnnotation(NameToken.class);
                SubsystemExtension subsystem = element.getAnnotation(SubsystemExtension.class);
                if (nameToken != null) {
                    System.out.println("Subsystem: " + subsystem.name() + " -> " + nameToken.value());
                    SubsystemExtensionMetaData declared = new SubsystemExtensionMetaData(
                            subsystem.name(), nameToken.value(),
                            subsystem.group(), subsystem.key()
                    );

                    subsystemDeclararions.add(declared);
                    if (!nameTokens.add(nameToken.value())) {
                        throw new RuntimeException("Duplicate name token '" + nameToken.value() + "' declared on '"
                                + element.asType());
                    }
                }
            }
        }
View Full Code Here


        List<? extends AnnotationMirror> annotationMirrors = element.getAnnotationMirrors();
        for (AnnotationMirror mirror : annotationMirrors) {
            final String annotationType = mirror.getAnnotationType().toString();

            if (annotationType.equals(NameToken.class.getName())) {
                NameToken nameToken = element.getAnnotation(NameToken.class);
                AccessControl accessControl = element.getAnnotation(AccessControl.class);

                if (accessControl != null) {

                    for (String resourceAddress : accessControl.resources()) {
                        AccessControlMetaData declared = new AccessControlMetaData(
                                nameToken.value()[0], resourceAddress
                        );

                        declared.setRecursive(accessControl.recursive());

                        accessControlDeclararions.add(declared);
                    }

                    for (String opString : accessControl.operations()) {

                        if (!opString.contains("#")) {
                            throw new IllegalArgumentException("Invalid operation string:" + opString);
                        }

                        BootstrapOperation op = new BootstrapOperation(
                                nameToken.value()[0], opString
                        );
                        bootstrapOperations.add(op);
                    }


                } else if (element.getAnnotation(NoGatekeeper.class) == null) {
                    Name simpleName = element.getEnclosingElement() != null ? element.getEnclosingElement()
                            .getSimpleName() : element.getSimpleName();
                    System.out.println(
                            simpleName + "(#" + nameToken.value()[0] + ")" + " is missing @AccessControl annotation!");
                }
            }
        }
    }
View Full Code Here

        List<? extends AnnotationMirror> annotationMirrors = element.getAnnotationMirrors();
        for (AnnotationMirror mirror : annotationMirrors) {
            final String annotationType = mirror.getAnnotationType().toString();

            if (annotationType.equals(NameToken.class.getName())) {
                NameToken nameToken = element.getAnnotation(NameToken.class);
                AccessControl accessControl = element.getAnnotation(AccessControl.class);
                SearchIndex searchIndex = element.getAnnotation(SearchIndex.class);
                OperationMode operationMode = element.getAnnotation(OperationMode.class);

                if (accessControl != null) {
                    boolean standalone = true;
                    boolean domain = true;
                    String[] keywords = null;
                    boolean include = true;
                    if (searchIndex != null) {
                        keywords = searchIndex.keywords();
                        include = !searchIndex.exclude();
                    }
                    if (operationMode != null) {
                        standalone = operationMode.value() == OperationMode.Mode.STANDALONE;
                        domain = operationMode.value() == OperationMode.Mode.DOMAIN;
                    }
                    if (include) {
                        // excluded presenters are not part of the metadata!
                        SearchIndexMetaData searchIndexMetaData = new SearchIndexMetaData(nameToken.value()[0], standalone,
                                domain, accessControl.resources(), keywords);
                        searchIndexDeclarations.add(searchIndexMetaData);
                    }
                }
            }
View Full Code Here

    private void handleRuntimeExtensions(Element element) {
        List<? extends AnnotationMirror> annotationMirrors = element.getAnnotationMirrors();
        for (AnnotationMirror mirror : annotationMirrors) {
            final String annotationType = mirror.getAnnotationType().toString();
            if (annotationType.equals(RuntimeExtension.class.getName())) {
                NameToken nameToken = element.getAnnotation(NameToken.class);
                RuntimeExtension extension = element.getAnnotation(RuntimeExtension.class);
                if (nameToken != null) {
                    System.out.println("Runtime Extension: " + extension.name() + " -> " + nameToken.value()[0]);
                    RuntimeExtensionMetaData declared = new RuntimeExtensionMetaData(
                            extension.name(), nameToken.value()[0],
                            extension.group(), extension.key()
                    );
                    runtimeExtensions.add(declared);
                }
            }
View Full Code Here

    private void handleSubsystemElement(Element element) {
        List<? extends AnnotationMirror> annotationMirrors = element.getAnnotationMirrors();
        for (AnnotationMirror mirror : annotationMirrors) {
            final String annotationType = mirror.getAnnotationType().toString();
            if (annotationType.equals(SubsystemExtension.class.getName())) {
                NameToken nameToken = element.getAnnotation(NameToken.class);
                SubsystemExtension subsystem = element.getAnnotation(SubsystemExtension.class);
                if (nameToken != null) {
                    System.out.println("Subsystem: " + subsystem.name() + " -> " + (nameToken.value()[0]));
                    SubsystemExtensionMetaData declared = new SubsystemExtensionMetaData(
                            subsystem.name(), nameToken.value()[0],
                            subsystem.group(), subsystem.key()
                    );

                    subsystemDeclararions.add(declared);
                    if (!nameTokens.add(nameToken.value()[0])) {
                        throw new RuntimeException("Duplicate name token '" + nameToken.value()[0] + "' declared on '"
                                + element.asType());
                    }
                }
            }
        }
View Full Code Here

        {
            final String annotationType = mirror.getAnnotationType().toString();

            if ( annotationType.equals(RuntimeExtension.class.getName()) )
            {
                NameToken nameToken = element.getAnnotation(NameToken.class);
                RuntimeExtension extension = element.getAnnotation(RuntimeExtension.class);

                if(nameToken!=null)   {
                    System.out.println("Runtime Extension: " + extension.name() +" -> "+nameToken.value());

                    RuntimeExtensionMetaData declared = new RuntimeExtensionMetaData(
                            extension.name(), nameToken.value(),
                            extension.group(), extension.key()
                    );

                    runtimeExtensions.add(declared);
                }
View Full Code Here

        {
            final String annotationType = mirror.getAnnotationType().toString();

            if ( annotationType.equals(SubsystemExtension.class.getName()) )
            {
                NameToken nameToken = element.getAnnotation(NameToken.class);
                SubsystemExtension subsystem = element.getAnnotation(SubsystemExtension.class);

                if(nameToken!=null)   {
                    System.out.println("Subsystem: " + subsystem.name() +" -> "+nameToken.value());

                    SubsystemExtensionMetaData declared = new SubsystemExtensionMetaData(
                            subsystem.name(), nameToken.value(),
                            subsystem.group(), subsystem.key()
                    );

                    subsystemDeclararions.add(declared);
                    if (!nameTokens.add(nameToken.value())) {
                        throw new RuntimeException("Duplicate name token '" + nameToken.value() + "' declared on '"
                                + element.asType());
                    }
                }
            }
        }
View Full Code Here

            composerFactory.addImport(Throwable.class.getCanonicalName());
        }
    }

    private void findNameTokens(JClassType proxyInterface) throws UnableToCompleteException {
        NameToken nameTokenAnnotation = proxyInterface.getAnnotation(NameToken.class);
        if (nameTokenAnnotation == null) {
            logger.log(TreeLogger.ERROR,
                    String.format("The proxy for '%s' is a Place, but is not annotated with @' +%s.",
                            presenterInspector.getPresenterClassName(), NameToken.class.getSimpleName()));
            throw new UnableToCompleteException();
        }
        nameTokens = nameTokenAnnotation.value();
        if (nameTokens.length == 0) {
            logger.log(TreeLogger.ERROR,
                    String.format("The proxy for '%s' is annotated with '@%s', but has no name token specified.",
                            presenterInspector.getPresenterClassName(), NameToken.class.getSimpleName()));
            throw new UnableToCompleteException();
View Full Code Here

     */
    private static Map<String, JClassType> findPlaceTokens(final GeneratorContext generatorContext) {
        Map<String, JClassType> placeTokens = new HashMap<String, JClassType>();

        for (JClassType type : generatorContext.getTypeOracle().getTypes()) {
            NameToken nameTokenAnnotation = type.getAnnotation(NameToken.class);
            if (nameTokenAnnotation != null) {
                for (String nameToken : nameTokenAnnotation.value()) {
                    placeTokens.put(nameToken, type);
                }
            }
        }

View Full Code Here

        {
            final String annotationType = mirror.getAnnotationType().toString();

            if ( annotationType.equals(NameToken.class.getName()) )
            {
                NameToken nameToken = element.getAnnotation(NameToken.class);
                AccessControl accessControl = element.getAnnotation(AccessControl.class);

                if(accessControl!=null)   {

                    for(String resourceAddress : accessControl.resources())
                    {
                        AccessControlMetaData declared = new AccessControlMetaData(
                                nameToken.value(), resourceAddress
                        );

                        declared.setFacet(accessControl.facet());
                        declared.setRecursive(accessControl.recursive());

                        accessControlDeclararions.add(declared);
                    }
                }
                else if(element.getAnnotation(NoGatekeeper.class)==null)
                {
                    Name simpleName = element.getEnclosingElement()!=null ? element.getEnclosingElement().getSimpleName() : element.getSimpleName();
                    System.out.println(simpleName +"(#"+nameToken.value()+")" +" is missing @AccessControl annotation!");
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.gwtplatform.mvp.client.annotations.NameToken

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.