comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java @ 3920:8483d190b2e7

Convert FKYSArtifact data member to a private variable Add setData and use getAllData in classes which access data directly. flys-artifacts/trunk@5600 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Ricks <bjoern.ricks@intevation.de>
date Wed, 26 Sep 2012 10:56:52 +0000
parents f858028dde5f
children 33fcc786f246
comparison
equal deleted inserted replaced
3919:355c843245c1 3920:8483d190b2e7
90 90
91 /** The name of the artifact. */ 91 /** The name of the artifact. */
92 protected String name; 92 protected String name;
93 93
94 /** The data that have been inserted into this artifact. */ 94 /** The data that have been inserted into this artifact. */
95 protected Map<String, StateData> data; 95 private Map<String, StateData> data;
96 96
97 /** Mapping of state names to created facets. */ 97 /** Mapping of state names to created facets. */
98 protected Map<String, List<Facet>> facets; 98 protected Map<String, List<Facet>> facets;
99 99
100 /** 100 /**
755 */ 755 */
756 public StateData getData(String name) { 756 public StateData getData(String name) {
757 return data.get(name); 757 return data.get(name);
758 } 758 }
759 759
760 /**
761 * A derived Artifact class can use this method to set the data
762 */
763 protected void setData(Map<String, StateData> data) {
764 this.data = data;
765 }
760 766
761 /** Return named data item, null if not found. */ 767 /** Return named data item, null if not found. */
762 public String getDataAsString(String name) { 768 public String getDataAsString(String name) {
763 StateData data = getData(name); 769 StateData data = getData(name);
764 return data != null ? (String) data.getValue() : null; 770 return data != null ? (String) data.getValue() : null;
867 */ 873 */
868 public void addStringData(String name, String value) { 874 public void addStringData(String name, String value) {
869 addData(name, new DefaultStateData(name, null, null, value)); 875 addData(name, new DefaultStateData(name, null, null, value));
870 } 876 }
871 877
872 878 /**
879 * This method returns all stored StateData in this artifact as a Collection
880 * @return a Collection of all StateData objects in this artifact
881 */
873 public Collection<StateData> getAllData() { 882 public Collection<StateData> getAllData() {
874 return data.values(); 883 return data.values();
875 } 884 }
876 885
877 886

http://dive4elements.wald.intevation.org