Package com.caucho.jsp.cfg

Examples of com.caucho.jsp.cfg.TldAttribute


   * Finds an attribute.
   */
  public TldAttribute findAttribute(String name)
  {
    for (int i = 0; i < _attributes.size(); i++) {
      TldAttribute attr = _attributes.get(i);

      if (name.equals(attr.getName()))
        return attr;
    }

    return null;
  }
View Full Code Here


   */
  protected void generateAttributes(JspJavaWriter out)
    throws IOException, JspParseException
  {
    for (int i = 0; i < _attributes.size(); i++) {
      TldAttribute attr = _attributes.get(i);

      String name = attr.getName();

      String upperName;
      char ch = name.charAt(0);
      upperName = Character.toUpperCase(ch) + name.substring(1);

      Class cl = attr.getType();
      if (cl == null)
        cl = String.class;
      String type = cl.getName();

      String isSetName = "_jsp_" + name + "_isSet";
View Full Code Here

   */
  protected void generateTagAttributes(JspJavaWriter out)
    throws IOException, JspParseException
  {
    for (int i = 0; i < _attributes.size(); i++) {
      TldAttribute attr = _attributes.get(i);

      String name = attr.getName();

      String upperName;
      char ch = name.charAt(0);
      upperName = Character.toUpperCase(ch) + name.substring(1);

      Class cl = attr.getType();
      if (cl == null)
        cl = String.class;
      String type = cl.getName();

      String isSetName = "_jsp_" + name + "_isSet";
View Full Code Here

    init(className);
   
    TldTag tag = new TldTag();
   
    for (int i = 0; i < _attributes.size(); i++) {
      TldAttribute attr = _attributes.get(i);

      tag.addAttribute(attr);
    }
   
    for (int i = 0; i < _variables.size(); i++) {
View Full Code Here

    out.println("tag.setName(\"test\");");

    out.println("com.caucho.jsp.cfg.TldAttribute attr;");
    for (int i = 0; i < _attributes.size(); i++) {
      TldAttribute attr = _attributes.get(i);

      out.println("attr = new com.caucho.jsp.cfg.TldAttribute();");
      out.println("attr.setName(\"" + attr.getName() + "\");");

      Class type = attr.getType();
      if (type != null) {
        out.print("attr.setType(");
        out.printClass(type);
        out.println(".class);");
      }
      out.println("attr.setRtexprvalue(" + attr.getRtexprvalue() + ");");
      out.println("attr.setRequired(" + attr.getRequired() + ");");

      if (attr.getDeferredValue() != null) {
        out.println("attr.setDeferredValue(new com.caucho.jsp.cfg.TldAttribute.DeferredValue());");

        if (attr.getDeferredValue().getType() != null) {
          out.print("attr.getDeferredValue().setType(\"");
          out.printJavaString(attr.getDeferredValue().getType());
          out.println("\");");
        }
      }

      if (attr.getDeferredMethod() != null) {
        out.println("attr.setDeferredMethod(new com.caucho.jsp.cfg.TldAttribute.DeferredMethod());");

        Signature sig = attr.getDeferredMethod().getMethodSignature();

        if (sig != null) {
          out.print("attr.getDeferredMethod().setMethodSignature(");
          out.print("new com.caucho.config.types.Signature(\"");
          out.printJavaString(sig.getSignature());
View Full Code Here

      throw error(L.l("<{0}> needs a 'name' attribute.",
                      getTagName()));

    JavaTagGenerator tagGen = (JavaTagGenerator) _gen;

    TldAttribute attr = new TldAttribute();
    attr.setName(_name);

    if (_type == null) {
      attr.setType(String.class);
    }
    else {
      Class type = loadClass(_type);

      if (type == null)
        throw error(L.l("type '{0}' is an unknown class for tag attribute {1}.",
                        _type, _name));

      if (type.isPrimitive())
        throw error(L.l(
          "attribute type '{0}' cannot be a Java primitive for {1}.",
          _type,
          _name));

      attr.setType(type);
    }

    attr.setRequired(_isRequired);
   
    if (_isFragment && _isRtexprvalue != null)
      throw error(L.l("@attribute rtexprvalue cannot be set when fragment is true."));
   
    if (_isFragment && _type != null)
      throw error(L.l("@attribute type cannot be set when fragment is true."));

    if (_isRtexprvalue == null || Boolean.TRUE.equals(_isRtexprvalue))
      attr.setRtexprvalue(Boolean.TRUE);
   
    if (_isFragment)
      attr.setType(JspFragment.class);
   
    if (_deferredValue != null && _deferredValueType != null)
      throw error(L.l("@attribute deferredValue and deferredValueType may not both be specified"));
   
    if (_deferredMethod != null && _deferredMethodSignature != null)
      throw error(L.l("@attribute deferredMethod and deferredMethodSignature may not both be specified"));
   
    if ((_deferredValue != null || _deferredValueType != null)
        && (_deferredMethod != null || _deferredMethodSignature != null))
      throw error(L.l("@attribute deferredValue and deferredMethod may not both be specified"));

    if (Boolean.TRUE.equals(_deferredValue) || _deferredValueType != null) {
      attr.setDeferredValue(new TldAttribute.DeferredValue());

      if (_deferredValueType != null)
        attr.getDeferredValue().setType(_deferredValueType);
    }

    if (Boolean.TRUE.equals(_deferredMethod)
        || _deferredMethodSignature != null) {
      attr.setDeferredMethod(new TldAttribute.DeferredMethod());

      if (_deferredMethodSignature != null)
        attr.getDeferredMethod().setMethodSignature(new Signature(_deferredMethodSignature));
    }

    tagGen.addAttribute(attr);
  }
View Full Code Here

    if (_nameFromAttribute == null)
      return;

    ArrayList<TldAttribute> attributes = gen.getAttributes();
    for (int i = 0; i < attributes.size(); i++) {
      TldAttribute attr = attributes.get(i);

      if (! attr.getName().equals(_nameFromAttribute))
        continue;

      if (! String.class.equals(attr.getType()))
        throw error(L.l("name-from-attribute variable '{0}' needs a matching String attribute, not '{1}', because the JSP 2.1 specification requires a String.",
                        _nameFromAttribute, attr.getType().getName()));

      if (! attr.getRequired() && attr.getRequiredVar() != null)
        throw error(L.l("name-from-attribute '{0}' needs an attribute declaration with the required=\"true\" attribute, according to the JSP 2.1 specification.",
                        _nameFromAttribute));

      return;
    }
View Full Code Here

   * Finds an attribute.
   */
  public TldAttribute findAttribute(String name)
  {
    for (int i = 0; i < _attributes.size(); i++) {
      TldAttribute attr = _attributes.get(i);

      if (name.equals(attr.getName()))
  return attr;
    }

    return null;
  }
View Full Code Here

   */
  protected void generateAttributes(JspJavaWriter out)
    throws IOException, JspParseException
  {
    for (int i = 0; i < _attributes.size(); i++) {
      TldAttribute attr = _attributes.get(i);

      String name = attr.getName();

      String upperName;
      char ch = name.charAt(0);
      upperName = Character.toUpperCase(ch) + name.substring(1);

      Class cl = attr.getType();
      if (cl == null)
        cl = String.class;
      String type = cl.getName();

      String isSetName = "_jsp_" + name + "_isSet";
View Full Code Here

   */
  protected void generateTagAttributes(JspJavaWriter out)
    throws IOException, JspParseException
  {
    for (int i = 0; i < _attributes.size(); i++) {
      TldAttribute attr = _attributes.get(i);

      String name = attr.getName();

      String upperName;
      char ch = name.charAt(0);
      upperName = Character.toUpperCase(ch) + name.substring(1);

      Class cl = attr.getType();
      if (cl == null)
        cl = String.class;
      String type = cl.getName();

      String isSetName = "_jsp_" + name + "_isSet";
View Full Code Here

TOP

Related Classes of com.caucho.jsp.cfg.TldAttribute

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.