Package juzu.impl.common

Examples of juzu.impl.common.Name


  // end::init[]

  // tag::processAnnotationAdded[]
  @Override
  public void processAnnotationAdded(ApplicationMetaModel application, AnnotationKey key, AnnotationState added) {
    Name type = key.getType();
    if (type.toString().equals(BundleGen.class.getName())) {
      ElementHandle.Package pkg = (ElementHandle.Package)key.getElement();
      bundles.put(pkg, (String)added.get("value"));
    }
  }
View Full Code Here


  // end::processAnnotationAdded[]

  // tag::processAnnotationRemoved[]
  @Override
  public void processAnnotationRemoved(ApplicationMetaModel application, AnnotationKey key, AnnotationState removed) {
    Name type = key.getType();
    if (type.toString().equals(BundleGen.class.getName())) {
      ElementHandle.Package pkg = (ElementHandle.Package)key.getElement();
      bundles.remove(pkg);
    }
  }
View Full Code Here

        delta.add(new AnnotationChange(key, entry.getValue(), null));
        processingContext.log(Level.FINER, "Annotation removed " + key);
      } else {
        AnnotationMirror found = null;
        for (AnnotationMirror mirror : element.getAnnotationMirrors()) {
          Name f = Name.parse(((TypeElement)mirror.getAnnotationType().asElement()).getQualifiedName().toString());
          if (key.getType().equals(f)) {
            found = mirror;
            break;
          }
        }
View Full Code Here

      emitController(application.model.processingContext, controller);
    }
  }

  private void emitController(ProcessingContext env, ControllerMetaModel controller) throws ProcessingException {
    Name fqn = controller.getHandle().getName();
    Element origin = env.get(controller.getHandle());
    Collection<HandlerMetaModel> methods = controller.getHandlers();
    Writer writer = null;
    try {
      JavaFileObject file = env.createSourceFile(fqn + "_", origin);
      writer = file.openWriter();

      //
      writer.append("package ").append(fqn.getParent()).append(";\n");

      // Imports
      writer.append("import ").append(ControllerHandler.class.getCanonicalName()).append(";\n");
      writer.append("import ").append(ControlParameter.class.getCanonicalName()).append(";\n");
      writer.append("import ").append(PhaseParameter.class.getCanonicalName()).append(";\n");
      writer.append("import ").append(ContextualParameter.class.getCanonicalName()).append(";\n");
      writer.append("import ").append(BeanParameter.class.getCanonicalName()).append(";\n");
      writer.append("import ").append(Tools.class.getCanonicalName()).append(";\n");
      writer.append("import ").append(Arrays.class.getCanonicalName()).append(";\n");
      writer.append("import ").append(Phase.class.getCanonicalName()).append(";\n");
      writer.append("import ").append(ControllerDescriptor.class.getCanonicalName()).append(";\n");
      writer.append("import ").append(Generated.class.getCanonicalName()).append(";\n");
      writer.append("import ").append(Cardinality.class.getCanonicalName()).append(";\n");
      writer.append("import ").append(Request.class.getCanonicalName()).append(";\n");

      // Open class
      writer.append("@Generated(value={})\n");
      writer.append("public class ").append(fqn.getIdentifier()).append("_ {\n");

      // Class literal
      writer.append("private static final Class<").append(fqn).append("> TYPE = ").append(fqn).append(".class;\n");

      //
View Full Code Here

        throw DUPLICATE_ASSET_ID.failure(asset.id);
      }
    }

    //
    Name qn = metaModel.getHandle().getPackageName().append("assets");
    if(!context.isCopyFromSourcesExternallyManaged()) {

      //
      HashMap<String, URL> bilta = new HashMap<String, URL>();
      HashMap<URL, Asset> bilto = new HashMap<URL, Asset>();
View Full Code Here

    return Collections.<Class<? extends java.lang.annotation.Annotation>>singleton(WebJars.class);
  }
 
  @Override
  public void processAnnotationAdded(ApplicationMetaModel metaModel, AnnotationKey key, AnnotationState added) {
    Name pkg = key.getElement().getPackageName();
    AssetsMetaModel assetsMetaModel = metaModel.getChild(AssetsMetaModel.KEY);
    for (Map.Entry<String, URL> entry : getAssets(metaModel, added).entrySet()) {
      assetsMetaModel.addResource(entry.getKey(), entry.getValue());

    }
View Full Code Here

    ApplicationMetaModel application = (ApplicationMetaModel)metaModel;
    ProcessingContext context = application.getProcessingContext();
    boolean relative = path.length() == 0 || path.charAt(0) != '/';
    if (relative) {
      context.info("Resolving classpath asset " + path);
      Name qn = application.getHandle().getPackageName().append("assets");
      FileObject src;
      try {
        src = context.resolveResourceFromSourcePath(pkg, qn, path);
      }
      catch (Exception e) {
View Full Code Here

    }
  }

  @Override
  public void processAnnotationRemoved(ApplicationMetaModel metaModel, AnnotationKey key, AnnotationState removed) {
    Name pkg = key.getElement().getPackageName();
    AssetsMetaModel assetsMetaModel = metaModel.getChild(AssetsMetaModel.KEY);
    for (Map.Entry<String, URL> entry : getAssets(metaModel, removed).entrySet()) {
      assetsMetaModel.removeResource(entry.getKey(), entry.getValue());

    }
View Full Code Here

    //
    Map<String, URL> ret = Collections.emptyMap();

    //
    Name pkg = metaModel.getHandle().getPackageName();
    ProcessingContext env = metaModel.processingContext;
    List<AnnotationState> webJars = (List<AnnotationState>)annotation.get("value");
    if (webJars != null && webJars.size() > 0) {
      for(AnnotationState webJar : webJars) {
        log.info("Processing declared webjars " + webJar);
View Full Code Here

    context.processEvents();
  }

  void emitApplication(ProcessingContext env, ApplicationMetaModel application) throws ProcessingException {
    PackageElement elt = env.get(application.getHandle());
    Name fqn = application.getName().append("Application");

    //
    Writer writer = null;
    try {
      JavaFileObject applicationFile = env.createSourceFile(fqn, elt);
      writer = applicationFile.openWriter();

      writer.append("package ").append(fqn.getParent()).append(";\n");

      // Imports
      writer.append("import ").append(ApplicationDescriptor.class.getCanonicalName()).append(";\n");

      // Open class
      writer.append("public class ").append(fqn.getIdentifier()).append(" {\n");

      // Field
      writer.append("private final ").append(APPLICATION_DESCRIPTOR).append(" descriptor;\n");

      // Constructor
      writer.append("public ").append(fqn.getIdentifier()).append("() throws Exception {\n");
      writer.append("this.descriptor = ").append(APPLICATION_DESCRIPTOR).append(".create(getClass());\n");
      writer.append("}\n");

      // Getter
      writer.append("public ").append(APPLICATION_DESCRIPTOR).append(" getDescriptor() {\n");
View Full Code Here

TOP

Related Classes of juzu.impl.common.Name

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.