001/** 002 * 003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved. 004 * 005 * This library is free software; you can redistribute it and/or 006 * modify it under the terms of the GNU Lesser General Public 007 * License as published by the Free Software Foundation; either 008 * version 2.1 of the License, or (at your option) any later version. 009 * 010 * This library is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013 * Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public 016 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 017 * 018 **/ 019package lucee.runtime.text.feed; 020 021import lucee.runtime.type.Collection; 022import lucee.runtime.type.StructImpl; 023 024public class FeedStruct extends StructImpl { 025 026 private boolean hasAttribute; 027 private String path; 028 private Key inside; 029 030 private StringBuilder content; 031 private String uri; 032 033 034 public FeedStruct(String path, Key inside, String uri) { 035 this.path=path; 036 this.inside=inside; 037 this.uri=uri; 038 } 039 040 public FeedStruct() { 041 } 042 043 044 /** 045 * @return the uri 046 */ 047 public String getUri() { 048 return uri; 049 } 050 051 /** 052 * @param hasAttribute the hasAttribute to set 053 */ 054 public void setHasAttribute(boolean hasAttribute) { 055 this.hasAttribute = hasAttribute; 056 } 057 058 public boolean hasAttribute() { 059 return hasAttribute || !isEmpty(); 060 } 061 062 /** 063 * @return the path 064 */ 065 public String getPath() { 066 return path; 067 } 068 069 /** 070 * @return the inside 071 */ 072 public Key getInside() { 073 return inside; 074 } 075 076 public void append(String str) { 077 if(content==null) content=new StringBuilder(); 078 content.append(str); 079 } 080 081 public String getString() { 082 if(content==null) return""; 083 return content.toString(); 084 } 085 086 @Override 087 public Collection duplicate(boolean deepCopy) { 088 FeedStruct trg=new FeedStruct(path,inside,uri); 089 trg.hasAttribute=hasAttribute; 090 copy(this, trg, deepCopy); 091 return trg; 092 } 093 094}