Package railo.transformer.bytecode.statement.tag

Examples of railo.transformer.bytecode.statement.tag.Attribute


        hint=LitString.EMPTY;
        meta=null;
        if(data.docComment!=null){
          Map<String, Attribute> params = data.docComment.getParams();
          Attribute[] attrs = params.values().toArray(new Attribute[params.size()]);
          Attribute attr;
          String name;
         
          for(int i=0;i<attrs.length;i++){
            attr=attrs[i];
            name=attr.getName();
            // hint
            if(idName.equalsIgnoreCase(name) || name.equalsIgnoreCase(idName+".hint")) {
              hint=CastString.toExprString(attr.getValue());
              params.remove(name);
            }
            //meta
            if(StringUtil.startsWithIgnoreCase(name, idName+".")) {
              if(name.length()>idName.length()+1){
                if(meta==null) meta=new HashMap<String, Attribute>();
                _name=name.substring(idName.length()+1);
                meta.put(_name, new Attribute(attr.isDynamicType(), _name,attr.getValue(), attr.getType()));
              }
              params.remove(name);
            }
          }
         
        }
       
        // argument attributes
        Attribute[] _attrs = attributes(null,null,data,COMMA_ENDBRACKED,LitString.EMPTY,Boolean.TRUE,null,false);
        Attribute _attr;
        if(!ArrayUtil.isEmpty(_attrs)){
          if(meta==null) meta=new HashMap<String, Attribute>();
          for(int i=0;i<_attrs.length;i++){
            _attr=_attrs[i];
            meta.put(_attr.getName(), _attr);
          }
        }
       
        func.addArgument(
            LitString.toExprString(idName),
View Full Code Here


    tag.addMetaData(data.docComment.getHintAsAttribute());
   
    Map<String, Attribute> params = data.docComment.getParams();
    Iterator<Attribute> it = params.values().iterator();
    Attribute attr;
    outer:while(it.hasNext()){
      attr = it.next();
      // ignore list
      if(!ArrayUtil.isEmpty(ignoreList)) {
        for(int i=0;i<ignoreList.length;i++){
          if(ignoreList[i].equalsIgnoreCase(attr.getName())) continue outer;
        }
      }
      tag.addMetaData(attr)
    }
    data.docComment=null;
View Full Code Here

   
    int pos = data.cfml.getPos();
    String tmp=variableDec(data, true);
    if(!StringUtil.isEmpty(tmp)) {
      if(tmp.indexOf('.')!=-1) {
        property.addAttribute(new Attribute(false,"type",LitString.toExprString(tmp),"string"));
        hasType=true;
      }
      else {
        data.cfml.setPos(pos);
      }
    }
    else data.cfml.setPos(pos);
   
   
   
    // folgend wird tlt extra nicht uebergeben, sonst findet pruefung statt
    Attribute[] attrs = attributes(property,tlt,data,SEMI,  NULL,Boolean.FALSE,"name",true);
   
    checkSemiColonLineFeed(data,true,true);

    property.setTagLibTag(tlt);
    property.setScriptBase(true);
   
   
    Attribute attr;
   
    // first fill all regular attribute -> name="value"
    for(int i=attrs.length-1;i>=0;i--){
      attr=attrs[i];
      if(!attr.getValue().equals(NULL)){
        if(attr.getName().equalsIgnoreCase("name")){
          hasName=true;
          //attr=new Attribute(attr.isDynamicType(),attr.getName(),CastString.toExprString(attr.getValue()),"string");
        }
        else if(attr.getName().equalsIgnoreCase("type")){
          hasType=true;
          //attr=new Attribute(attr.isDynamicType(),attr.getName(),CastString.toExprString(attr.getValue()),"string");
        }
        property.addAttribute(attr);
      }
    }
   
    // now fill name named attributes -> attr1 attr2
   
    String first=null,second=null;
    for(int i=0;i<attrs.length;i++){
      attr=attrs[i];
     
      if(attr.getValue().equals(NULL)){
        // type
        if(first==null && (!hasName || !hasType)){
          first=attr.getName();
          //type=new Attribute(false,"type",LitString.toExprString(attr.getName()),"string");
          //property.addAttribute(type);
        }
        // name
        else if(second==null && !hasName && !hasType){
          second=attr.getName();
          //name=new Attribute(false,"name",LitString.toExprString(attr.getName()),"string");
          //property.addAttribute(name);
        }
        // attr with no value
        else {
          attr=new Attribute(true,attr.getName(),LitString.EMPTY,"string");
          property.addAttribute(attr);
        }
      }
    }

   
   
    if(first!=null) {
        hasName=true;
      if(second!=null){
        hasType=true;
        property.addAttribute(new Attribute(false,"name",LitString.toExprString(second),"string"));
        property.addAttribute(new Attribute(false,"type",LitString.toExprString(first),"string"));
      }
      else {
        property.addAttribute(new Attribute(false,"name",LitString.toExprString(first),"string"));
      }
    }
   
    if(!hasType)
      property.addAttribute(ANY);
View Full Code Here

    boolean hasType=false;
    int pos = data.cfml.getPos();
    String tmp=variableDec(data, true);
    if(!StringUtil.isEmpty(tmp)) {
      if(tmp.indexOf('.')!=-1) {
        param.addAttribute(new Attribute(false,"type",LitString.toExprString(tmp),"string"));
        hasType=true;
      }
      else data.cfml.setPos(pos);
    }
    else data.cfml.setPos(pos);
   
   
   
    // folgend wird tlt extra nicht uebergeben, sonst findet pruefung statt
    Attribute[] attrs = attributes(param,tlt,data,SEMI,  NULL,Boolean.TRUE,"name",true);
    checkSemiColonLineFeed(data,true,true);

    param.setTagLibTag(tlt);
    param.setScriptBase(true);
   
   
    Attribute attr;
   
    // first fill all regular attribute -> name="value"
    boolean hasDynamic=false;
    boolean hasName=false;
    for(int i=attrs.length-1;i>=0;i--){
      attr=attrs[i];
      if(!attr.getValue().equals(NULL)){
        if(attr.getName().equalsIgnoreCase("name")){
          hasName=true;
          param.addAttribute(attr);
        }
        else if(attr.getName().equalsIgnoreCase("type")){
          hasType=true;
          param.addAttribute(attr);
        }
        else if(attr.isDynamicType()){
          hasName=true;
          if(hasDynamic) throw attrNotSupported(data.cfml,tlt,attr.getName());
          hasDynamic=true;
          param.addAttribute(new Attribute(false,"name",LitString.toExprString(attr.getName()),"string"));
          param.addAttribute(new Attribute(false,"default",attr.getValue(),"any"));
        }
        else
          param.addAttribute(attr);
      }
    }
   
    // now fill name named attributes -> attr1 attr2
    String first=null,second=null;
    for(int i=0;i<attrs.length;i++){
      attr=attrs[i];
     
      if(attr.getValue().equals(NULL)){
        // type
        if(first==null && (!hasName || !hasType)){
          first=attr.getName();
        }
        // name
        else if(second==null && !hasName && !hasType){
          second=attr.getName();
        }
        // attr with no value
        else {
          attr=new Attribute(true,attr.getName(),LitString.EMPTY,"string");
          param.addAttribute(attr);
        }
      }
    }

   
    if(first!=null) {
      if(second!=null){
        hasName=true;
        hasType=true;
        if(hasDynamic) throw attrNotSupported(data.cfml,tlt,first);
        hasDynamic=true;
        param.addAttribute(new Attribute(false,"name",LitString.toExprString(second),"string"));
        param.addAttribute(new Attribute(false,"type",LitString.toExprString(first),"string"));
      }
      else {
        param.addAttribute(new Attribute(false,hasName?"type":"name",LitString.toExprString(first),"string"));
        hasName=true;
      }
    }
   
    //if(!hasType)
View Full Code Here

    }
   
    if(attrValue!=null){
      attrName=attr.getName();
      TagLibTagAttr tlta = tlt.getAttribute(attr.getName());
      tag.addAttribute(new Attribute(false,attrName,CastOther.toExpression(attrValue,tlta.getType()),tlta.getType()));
    }
    else if(ATTR_TYPE_REQUIRED==attrType){
      data.cfml.setPos(pos);
      return null;
    }
View Full Code Here

    while(data.cfml.isValidIndex())  {
      data.cfml.removeSpace();
      // if no more attributes break
      if(endCond.isEnd(data)) break;
      //if((allowBlock && data.cfml.isCurrent('{')) || data.cfml.isCurrent(';')) break;
      Attribute attr = attribute(tlt,data,ids,defaultValue,oAllowExpression, allowTwiceAttr);
      attrs.add(attr);
    }
   
    // not defined attributes
    if(tlt!=null){
View Full Code Here

      // Type
      TagLibTagAttr tlta=null;
    if(tlt!=null){
      tlta = tlt.getAttribute(name);
    }
    return new Attribute(dynamic.toBooleanValue(),name,tlta!=null?CastOther.toExpression(value, tlta.getType()):value,sbType.toString());
    }
View Full Code Here

   * @see railo.transformer.cfml.attributes.AttributeEvaluator#evaluate(railo.transformer.library.tag.TagLibTag, org.w3c.dom.Element)
   */
  public TagLibTag evaluate( TagLibTag tagLibTag, Tag tag) throws AttributeEvaluatorException {
    tagLibTag.setParseBody(false);
   
    Attribute attrOutput = tag.getAttribute("output");
    if(attrOutput==null) return tagLibTag;
   
    Expression expr = CastBoolean.toExprBoolean(attrOutput.getValue());
   
    if(!(expr instanceof LitBoolean))
      throw new AttributeEvaluatorException("Attribute output of the Tag Function, must be a literal boolean value (true or false)");
    boolean output = ((LitBoolean)expr).getBooleanValue();
    if(output)
View Full Code Here

   
// Attributes
   
    // output
    // "output=true" wird in "railo.transformer.cfml.attributes.impl.Function" geh�ndelt
    Attribute attr = tag.getAttribute("output");
    if(attr!=null) {
      Expression expr = CastBoolean.toExprBoolean(attr.getValue());
      if(!(expr instanceof LitBoolean))
        throw new EvaluatorException("Attribute output of the Tag "+tlt.getFullName()+", must contain a static boolean value (true or false, yes or no)");
      //boolean output = ((LitBoolean)expr).getBooleanValue();
      //if(!output) ASMUtil.removeLiterlChildren(tag, true);
    }
   
    // extends
    attr = tag.getAttribute("extends");
    if(attr!=null) {
      Expression expr = CastString.toExprString(attr.getValue());
      if(!(expr instanceof LitString)) throw new EvaluatorException("Attribute extends of the Tag "+tlt.getFullName()+", must contain a literal string value");
    }
   
    // implements
    if(isComponent){
      attr = tag.getAttribute("implements");
      if(attr!=null) {
        Expression expr = CastString.toExprString(attr.getValue());
        if(!(expr instanceof LitString)) throw new EvaluatorException("Attribute implements of the Tag "+tlt.getFullName()+", must contain a literal string value");
      }
    }
  }
View Full Code Here

    /**
     * @see railo.transformer.cfml.attributes.AttributeEvaluator#evaluate(railo.transformer.library.tag.TagLibTag, org.w3c.dom.Element)
     */
    public TagLibTag evaluate( TagLibTag tagLibTag, Tag tag) throws AttributeEvaluatorException {
    tagLibTag.setParseBody(false);
    Attribute attr = tag.getAttribute("output");
    if(attr!=null) {
      Expression expr = attr.getValue();
     
      if(!(expr instanceof LitBoolean))
        throw new AttributeEvaluatorException("Attribute output of the Tag Component, must be a static boolean value (true or false)");
      if(((LitBoolean)expr).getBooleanValue())
        tagLibTag.setParseBody(true);
View Full Code Here

TOP

Related Classes of railo.transformer.bytecode.statement.tag.Attribute

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.