001    package railo.runtime.text.feed;
002    
003    import railo.runtime.type.Collection;
004    import railo.runtime.type.StructImpl;
005    
006    public class FeedStruct extends StructImpl {
007    
008            private boolean hasAttribute;
009            private String path;
010            private Key inside;
011    
012            private StringBuilder content;
013            private String uri;
014            
015    
016            public FeedStruct(String path, Key inside, String uri) {
017                    this.path=path;
018                    this.inside=inside;
019                    this.uri=uri;
020            }
021    
022            public FeedStruct() {
023            }
024            
025    
026            /**
027             * @return the uri
028             */
029            public String getUri() {
030                    return uri;
031            }
032    
033            /**
034             * @param hasAttribute the hasAttribute to set
035             */
036            public void setHasAttribute(boolean hasAttribute) {
037                    this.hasAttribute = hasAttribute;
038            }
039    
040            public boolean hasAttribute() {
041                    return hasAttribute || !isEmpty();
042            }
043    
044            /**
045             * @return the path
046             */
047            public String getPath() {
048                    return path;
049            }
050    
051            /**
052             * @return the inside
053             */
054            public Key getInside() {
055                    return inside;
056            }
057            
058            public void append(String str) {
059                    if(content==null) content=new StringBuilder();
060                    content.append(str);
061            }
062            
063            public String getString() {
064                    if(content==null) return"";
065                    return content.toString();
066            }
067            
068            /**
069             * @see railo.runtime.type.StructImpl#duplicate(boolean)
070             */
071            public Collection duplicate(boolean deepCopy) {
072                    FeedStruct trg=new FeedStruct(path,inside,uri);
073                    trg.hasAttribute=hasAttribute;
074                    copy(this, trg, deepCopy);
075                    return trg;
076            }
077    
078    }