public void validate()
      throws ProcessorException {
    if (this.applicationElement instanceof TypeElement) {
      TypeElement typeElement = (TypeElement) this.applicationElement;
      // annotated element has to be a interface
      if (!typeElement.getKind()
                      .isInterface()) {
        throw new ProcessorException("Nalu-Processor: @Application annotated must be used with an interface");
      }
      // check, that the typeElement implements IsApplication
      if (!this.processorUtils.extendsClassOrInterface(this.processingEnvironment.getTypeUtils(),
                                                       typeElement.asType(),
                                                       this.processingEnvironment.getElementUtils()
                                                                                 .getTypeElement(IsApplication.class.getCanonicalName())
                                                                                 .asType())) {
        throw new ProcessorException("Nalu-Processor: " +
                                     typeElement.getSimpleName()
                                                .toString() +
                                     ": @Application must implement IsApplication interface");
      }
      // check if startRoute start with "/"
      Application applicationAnnotation = applicationElement.getAnnotation(Application.class);
      if (!applicationAnnotation.startRoute()
                                .startsWith("/")) {
        throw new ProcessorException("Nalu-Processor:" + "@Application - startRoute attribute muss begin with a '/'");
      }
      if (!applicationAnnotation.routeError()
                                .startsWith("/")) {
        throw new ProcessorException("Nalu-Processor:" + "@Application - routeError attribute muss begin with a '/'");
      }
    } else {
      throw new ProcessorException("Nalu-Processor:" + "@Application can only be used on a type (interface)");
    }
  }
public void validate ( ) throws ProcessorException { if ( this . applicationElement instanceof TypeElement ) { TypeElement typeElement = ( TypeElement ) this . applicationElement ; if ( ! typeElement . getKind ( ) . isInterface ( ) ) { throw new ProcessorException ( "Nalu-Processor: @Application annotated must be used with an interface" ) ; } if ( ! this . processorUtils . extendsClassOrInterface ( this . processingEnvironment . getTypeUtils ( ) , typeElement . asType ( ) , this . processingEnvironment . getElementUtils ( ) . getTypeElement ( IsApplication . class . getCanonicalName ( ) ) . asType ( ) ) ) { throw new ProcessorException ( "Nalu-Processor: " + typeElement . getSimpleName ( ) . toString ( ) + ": @Application must implement IsApplication interface" ) ; } Application applicationAnnotation = applicationElement . getAnnotation ( Application . class ) ; if ( ! applicationAnnotation . startRoute ( ) . startsWith ( "/" ) ) { throw new ProcessorException ( "Nalu-Processor:" + "@Application - startRoute attribute muss begin with a '/'" ) ; } if ( ! applicationAnnotation . routeError ( ) . startsWith ( "/" ) ) { throw new ProcessorException ( "Nalu-Processor:" + "@Application - routeError attribute muss begin with a '/'" ) ; } } else { throw new ProcessorException ( "Nalu-Processor:" + "@Application can only be used on a type (interface)" ) ; } }
}