1 9 10 package org.ozoneDB.xml.dom4j.o3impl; 11 12 import org.dom4j.Element; 13 import org.dom4j.Node; 14 15 28 public class FlyweightEntity extends AbstractEntity { 29 30 31 protected String name; 32 33 34 protected String text; 35 36 38 protected FlyweightEntity() { 39 } 40 41 45 public FlyweightEntity(String name) { 46 this.name = name; 47 } 48 49 55 public FlyweightEntity(String name, String text) { 56 this.name = name; 57 this.text = text; 58 } 59 60 62 public String getName() { 63 return name; 64 } 65 66 68 public String getText() { 69 return text; 70 } 71 72 76 public void setText(String text) { 77 if (this.text != null) { 78 this.text = text; 79 } else { 80 throw new UnsupportedOperationException ( 81 "This Entity is read-only. It cannot be modified" 82 ); 83 } 84 } 85 86 protected Node createXPathResult(Element parent) { 87 return new DefaultEntity(parent, getName(), getText()); 88 } 89 } 90 91 92 136 | Popular Tags |