Examples of AnnotationState


Examples of com.sun.msv.schmit.reader.AnnotationState

    }

    protected State createChildState(StartTagInfo tag) {
        if(Util.isAnnotationElement(tag))
            // parse it as an annotation
            return new AnnotationState( ((SchmitXMLSchemaReader)reader).dom );
        else
            return super.createChildState(tag);
    }
View Full Code Here

Examples of com.sun.msv.schmit.reader.AnnotationState

    }

    protected State createChildState(StartTagInfo tag) {
        if(Util.isAnnotationElement(tag))
            // parse it as an annotation
            return new AnnotationState( ((SchmitXMLSchemaReader)reader).dom );
        else
            return super.createChildState(tag);
    }
View Full Code Here

Examples of juzu.impl.metamodel.AnnotationState

      router.routes.clear();
      ControllersMetaModel controllers = metaModel.getChild(ControllersMetaModel.KEY);
      if (controllers != null) {
        for (ControllerMetaModel controller : controllers) {
          for (HandlerMetaModel method : controller) {
            AnnotationState annotation = router.annotations.get(method.getMethod());
            if (annotation != null) {
              String path = (String)annotation.get("value");
              Integer priority = (Integer)annotation.get("priority");
              HashMap<String, ParamDescriptor> parameters = null;
              ExecutableElement exe = metaModel.processingContext.get(method.getMethod());
              for (VariableElement ve : exe.getParameters()) {
                Param param = ve.getAnnotation(Param.class);
                if (param != null) {
View Full Code Here

Examples of juzu.impl.metamodel.AnnotationState

  @Override
  public void init(ApplicationMetaModel application) {
    ControllersMetaModel controllers = new ControllersMetaModel(this);
    PackageElement pkg = application.model.processingContext.get(application.getHandle());
    AnnotationMirror annotation = Tools.getAnnotation(pkg, Application.class.getName());
    AnnotationState values = AnnotationState.create(annotation);
    Boolean escapeXML = (Boolean)values.get("escapeXML");
    ElementHandle.Type defaultControllerElt = (ElementHandle.Type)values.get("defaultController");
    ElementHandle.Type errorControllerElt = (ElementHandle.Type)values.get("errorController");
    controllers.escapeXML = escapeXML;
    controllers.defaultController = defaultControllerElt != null ? defaultControllerElt.getName() : null;
    controllers.errorController = errorControllerElt != null ? errorControllerElt.getName() : null;
    application.addChild(ControllersMetaModel.KEY, controllers);
  }
View Full Code Here

Examples of juzu.impl.metamodel.AnnotationState

    HashMap<Name, AnnotationState> clone = annotations;
    annotations = null;

    //
    for (Map.Entry<Name, AnnotationState> entry : clone.entrySet()) {
      AnnotationState annotation = entry.getValue();
      Name pkg = entry.getKey();
      ProcessingContext env = metaModel.processingContext;
      ElementHandle.Package pkgHandle = ElementHandle.Package.create(pkg);
      PackageElement pkgElt = env.get(pkgHandle);
      Boolean minify = (Boolean)annotation.get("minify");
      List<String> resources = (List<String>)annotation.get("value");

      // WARNING THIS IS NOT CORRECT BUT WORK FOR NOW
      AnnotationMirror annotationMirror = Tools.getAnnotation(pkgElt, Less.class.getName());

      //
View Full Code Here

Examples of juzu.impl.metamodel.AnnotationState

  }

  @Override
  public void postProcessAnnotations(ApplicationMetaModel metaModel) {
    ElementHandle.Package pkg = metaModel.getHandle();
    AnnotationState annotation = servlets.remove(pkg);
    if (annotation != null) {
      PackageElement pkgElt = metaModel.processingContext.get(pkg);
      String urlPattern = (String)annotation.get("value");
      String simpleName = (String)annotation.get("name");
      String resourceBundle = (String)annotation.get("resourceBundle");
      if (simpleName == null) {
        simpleName = metaModel.getBaseName() + "Servlet";
      }
      Name clazz = pkg.getPackageName().append(simpleName);
      Writer writer = null;
View Full Code Here

Examples of juzu.impl.metamodel.AnnotationState

  public void testAnnotationState() {
    CaptureAnnotationProcessor processor = new CaptureAnnotationProcessor().with(StringArray.class);
    compiler("compiler.annotationstate.multivalued").with(compilerProvider).with(processor).assertCompile();

    //
    AnnotationState m1 = processor.get(ElementHandle.Method.create("compiler.annotationstate.multivalued.A", "m1"), StringArray.class);
    assertTrue(m1.isUndeclared("value"));
    List<?> value = assertInstanceOf(List.class, m1.resolve("value"));
    assertNull(m1.get("value"));
    assertEquals(Collections.emptyList(), value);

    //
    AnnotationState m2 = processor.get(ElementHandle.Method.create("compiler.annotationstate.multivalued.A", "m2"), StringArray.class);
    assertTrue(m2.isDeclared("value"));
    value = assertInstanceOf(List.class, m2.resolve("value"));
    assertSame(value, m2.get("value"));
    assertEquals(Collections.emptyList(), value);

    //
    AnnotationState m3 = processor.get(ElementHandle.Method.create("compiler.annotationstate.multivalued.A", "m3"), StringArray.class);
    assertTrue(m3.isDeclared("value"));
    value = assertInstanceOf(List.class, m3.resolve("value"));
    assertSame(value, m3.get("value"));
    assertEquals(Arrays.asList("warning_value"), value);

    //
    AnnotationState m4 = processor.get(ElementHandle.Method.create("compiler.annotationstate.multivalued.A", "m4"), StringArray.class);
    assertTrue(m4.isDeclared("value"));
    value = assertInstanceOf(List.class, m4.resolve("value"));
    assertSame(value, m4.get("value"));
    assertEquals(Arrays.asList("warning_value"), value);

    //
    AnnotationState m5 = processor.get(ElementHandle.Method.create("compiler.annotationstate.multivalued.A", "m5"), StringArray.class);
    assertTrue(m5.isDeclared("value"));
    value = assertInstanceOf(List.class, m5.resolve("value"));
    assertSame(value, m5.get("value"));
    assertEquals(Arrays.asList("warning_value_1", "warning_value_2"), value);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.