示例#1
0
  /**
   * Imports the specified directives from the specified page definition.
   *
   * @param pgdef the page definition to import from.
   * @param directives an array of the directive names to import. If null, {"init", "component"} is
   *     assumed, i.e., only the init directives and component definitions are imported.<br>
   *     Importable directives include "component", "init", "meta", "taglib", "variable-resolver",
   *     and "xel-method". If "*", all of them are imported. Note: "meta" implies "link".
   * @since 3.0.2
   */
  public void imports(PageDefinition pgdef, String[] directives) {
    if (directives == null || contains(directives, "import"))
      _clsresolver.addAll(pgdef._clsresolver);

    if (pgdef._initdefs != null && (directives == null || contains(directives, "init")))
      for (InitiatorInfo ii : pgdef._initdefs) addInitiatorInfo(ii);

    if (directives == null || contains(directives, "component")) {
      for (Iterator it = pgdef._compdefs.getNames().iterator(); it.hasNext(); )
        addComponentDefinition(pgdef._compdefs.get((String) it.next()));
    }

    if (pgdef._taglibs != null && directives != null && contains(directives, "taglib"))
      for (Taglib tl : pgdef._taglibs) addTaglib(tl);

    if (pgdef._resolvdefs != null
        && directives != null
        && contains(directives, "variable-resolver")) {
      for (VariableResolverInfo vri : pgdef._resolvdefs) addVariableResolverInfo(vri);
    }

    if (pgdef._mapperdefs != null
        && directives != null
        && contains(directives, "function-mapper")) {
      for (FunctionMapperInfo fmi : pgdef._mapperdefs) addFunctionMapperInfo(fmi);
    }

    if (pgdef._xelfuncs != null && directives != null && contains(directives, "xel-method"))
      for (FunctionDefinition xfi : pgdef._xelfuncs)
        addXelMethod(xfi.prefix, xfi.name, xfi.function);

    if (pgdef._hdBfrDefs != null && directives != null && contains(directives, "meta")) {
      for (HeaderInfo hi : pgdef._hdBfrDefs) addHeaderInfo(hi, true);
    }
    if (pgdef._hdAftDefs != null && directives != null && contains(directives, "meta")) {
      for (HeaderInfo hi : pgdef._hdAftDefs) addHeaderInfo(hi, false);
    }

    if (pgdef._hdResDefs != null && directives != null && contains(directives, "header")) {
      for (ResponseHeaderInfo rhi : pgdef._hdResDefs) addResponseHeaderInfo(rhi);
    }
  }
示例#2
0
 /**
  * Returns a readonly list of the imported class names.
  *
  * @since 6.0.0
  */
 public List<String> getImportedClasses() {
   return _clsresolver.getImportedClasses();
 }
示例#3
0
 /**
  * Adds an imported class Like Java, it is used to import a class or a package of classes, so that
  * it simplifies the use of the apply attribute, the init directive and others.
  *
  * @param clsptn the class's fully-qualified name, e.g., <code>com.foo.FooComposer</code>, a
  *     wildcard representing all classes of the give package, e.g., <code>com.foo.*</code>.
  * @since 6.0.0
  */
 public void addImportedClass(String clsptn) throws ClassNotFoundException {
   _clsresolver.addImportedClass(clsptn);
 }