001    package railo.runtime.ext.tag;
002    
003    import java.util.ArrayList;
004    import java.util.List;
005    
006    public class TagMetaDataImpl implements TagMetaData {
007    
008            private int attrMin;
009            private int attrMax;
010            private int attrType;
011            private List attrs=new ArrayList();
012            private int bodyContent;
013            private String description;
014            private boolean isBodyRE;
015            private boolean handleException;
016            private boolean hasAppendix;
017            private boolean hasBody;
018            
019    
020    
021            /**
022             * Constructor of the class
023             * @param attrType TagMetaData.ATTRIBUTE_TYPE_FIX,TagMetaData.ATTRIBUTE_TYPE_DYNAMIC,TagMetaData.ATTRIBUTE_TYPE_MIXED
024             * @param attrMin minimal count of attributes needed for tag
025             * @param attrMax maximum count of attributes or -1 for infinity attributes
026             * @param bodyContent TagMetaData.BODY_CONTENT_EMPTY,TagMetaData.BODY_CONTENT_FREE,TagMetaData.BODY_CONTENT_MUST
027             * @param isBodyRE is the body of the tag parsed like inside a cfoutput
028             * @param description A description of the tag.
029             */
030            public TagMetaDataImpl(int attrType, int attrMin, int attrMax, int bodyContent, boolean isBodyRE, String description,
031                            boolean handleException, boolean hasAppendix, boolean hasBody) {
032                    this.attrMax = attrMax;
033                    this.attrMin = attrMin;
034                    this.attrType = attrType;
035                    this.description = description;
036                    this.isBodyRE = isBodyRE;
037                    this.handleException = handleException;
038                    this.hasAppendix = hasAppendix;
039                    this.hasBody = hasBody;
040            }
041            
042            @Override
043            public int getAttributeMax() {
044                    return attrMax;
045            }
046    
047            @Override
048            public int getAttributeMin() {
049                    return attrMin;
050            }
051    
052            @Override
053            public int getAttributeType() {
054                    return attrType;
055            }
056    
057            @Override
058            public TagMetaDataAttr[] getAttributes() {
059                    return (TagMetaDataAttr[]) attrs.toArray(new TagMetaDataAttr[attrs.size()]);
060            }
061            
062            /**
063             * adds a attribute to the tag
064             * @param attr
065             */
066            public void addAttribute(TagMetaDataAttr attr) {
067                    attrs.add(attr);
068            }
069    
070            @Override
071            public int getBodyContent() {
072                    return bodyContent;
073            }
074    
075            @Override
076            public String getDescription() {
077                    return description;
078            }
079    
080            @Override
081            public boolean isBodyRuntimeExpressionValue() {
082                    return isBodyRE;
083            }
084    
085            @Override
086            public boolean handleException() {
087                    return handleException;
088            }
089    
090            @Override
091            public boolean hasAppendix() {
092                    return hasAppendix;
093            }
094    
095            @Override
096            public boolean hasBody() {
097                    return hasBody;
098            }
099    
100    }