Examples of UsePlugin


Examples of org.stjs.javascript.annotation.UsePlugin

    return writerVisitor;
  }

  @SuppressWarnings("unchecked")
  public GenerationPlugins<JS> forClass(Class<?> clazz) {
    UsePlugin usePlugins = clazz.getAnnotation(UsePlugin.class);
    if (usePlugins == null || usePlugins.value() == null || usePlugins.value().length == 0) {
      // this class uses the default plugins - no need to create a new one
      return this;
    }

    // TODO - here I can add a cache using the list of plugin names as key
    GenerationPlugins<JS> newPlugins = new GenerationPlugins<JS>();
    newPlugins.checkVisitor = new CheckVisitor(checkVisitor);
    newPlugins.writerVisitor = new WriterVisitor<JS>(writerVisitor);

    for (String pluginName : usePlugins.value()) {
      STJSGenerationPlugin<JS> plugin = optionalPlugins.get(pluginName);
      if (plugin == null) {
        throw new STJSRuntimeException("The class:" + clazz.getName() + " need an unknown Generation Plugin :" + pluginName);
      }
      plugin.contributeCheckVisitor(newPlugins.checkVisitor);
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.