comparison artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractResultType.java @ 9448:d32b11d585cd

CSV-Export bundu.wst fehlvolumen
author gernotbelger
date Wed, 22 Aug 2018 11:51:46 +0200
parents 1614cb14308f
children d7d22ea8573d
comparison
equal deleted inserted replaced
9447:3f4215ddd6b4 9448:d32b11d585cd
33 33
34 private final String csvHeader; 34 private final String csvHeader;
35 35
36 private final String pdfHeader; 36 private final String pdfHeader;
37 37
38 private static String YES = null;
39 private static String NO = null;
40
38 protected AbstractResultType(final String unit, final String csvHeader, final String pdfHeader) { 41 protected AbstractResultType(final String unit, final String csvHeader, final String pdfHeader) {
39 this.unit = unit; 42 this.unit = unit;
40 this.csvHeader = csvHeader; 43 this.csvHeader = csvHeader;
41 this.pdfHeader = pdfHeader; 44 this.pdfHeader = pdfHeader;
42 45
52 55
53 if (!(value instanceof String)) 56 if (!(value instanceof String))
54 throw new IllegalStateException(); 57 throw new IllegalStateException();
55 58
56 return (String) value; 59 return (String) value;
60 }
61
62 protected final String exportBooleanValue(final CallContext context, final Object value) {
63
64 if (value == null)
65 return StringUtils.EMPTY; // DISKUSSION; könnte auch "Nein" sein
66
67 if (!(value instanceof Boolean))
68 throw new IllegalStateException();
69
70 if ((boolean) value) {
71 if (YES == null)
72 YES = Resources.getMsg(context.getMeta(), String.valueOf(value));
73 return YES;
74 } else {
75 if (NO == null)
76 NO = Resources.getMsg(context.getMeta(), String.valueOf(value));
77 return NO;
78 }
57 } 79 }
58 80
59 @Override 81 @Override
60 public final double asDouble(final Object value) { 82 public final double asDouble(final Object value) {
61 if (value == null) 83 if (value == null)

http://dive4elements.wald.intevation.org