Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/TypeSection.java @ 9123:1cc7653ca84f
Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
author | gernotbelger |
---|---|
date | Tue, 05 Jun 2018 19:21:16 +0200 |
parents | 5e38e2924c07 |
children |
comparison
equal
deleted
inserted
replaced
9122:b8e7f6becf78 | 9123:1cc7653ca84f |
---|---|
121 | 121 |
122 return null; | 122 return null; |
123 } | 123 } |
124 | 124 |
125 | 125 |
126 public void setBooleanValue(String key, boolean value) { | 126 protected final void setBooleanValue(String key, boolean value) { |
127 Attribute attr = getAttribute(key); | 127 final Attribute attr = getAttribute(key); |
128 if (attr == null) { | 128 if (attr == null) |
129 attr = new BooleanAttribute(key, value, true); | 129 addAttribute(key, new BooleanAttribute(key, value, true)); |
130 addAttribute(key, attr); | 130 else |
131 } | |
132 else { | |
133 attr.setValue(value); | 131 attr.setValue(value); |
134 } | |
135 } | 132 } |
136 | 133 |
137 | 134 protected final boolean getBooleanValue(final String key, boolean defaultValue) { |
138 public Boolean getBooleanValue(String key) { | 135 final Attribute attr = getAttribute(key); |
139 Attribute attr = getAttribute(key); | |
140 | 136 |
141 if (attr instanceof BooleanAttribute) { | 137 if (attr instanceof BooleanAttribute) { |
142 return (Boolean) attr.getValue(); | 138 final Boolean value = (Boolean) attr.getValue(); |
139 if( value == null ) | |
140 return defaultValue; | |
141 | |
142 return value; | |
143 } | 143 } |
144 | 144 |
145 return null; | 145 return defaultValue; |
146 } | 146 } |
147 } | 147 } |
148 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |