Examples of TldAttribute


Examples of com.caucho.jsp.cfg.TldAttribute

    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

Examples of com.caucho.jsp.cfg.TldAttribute

    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

Examples of com.caucho.jsp.cfg.TldAttribute

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

    JavaTagGenerator tagGen = (JavaTagGenerator) _gen;

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

    if (_type != null) {
      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

Examples of com.caucho.jsp.cfg.TldAttribute

    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
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.