comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/util/BedHeightInfo.java @ 9230:6a1580b38e7d

Using a bed height without year in tkh calculation now throws an immediate error
author gernotbelger
date Fri, 06 Jul 2018 13:08:15 +0200
parents 5d5d482da3e9
children b9c87bbff6a4
comparison
equal deleted inserted replaced
9229:0dcd1cd41915 9230:6a1580b38e7d
44 public static BedHeightInfo from(final BedHeight bedHeight) { 44 public static BedHeightInfo from(final BedHeight bedHeight) {
45 return new BedHeightInfo(bedHeight); 45 return new BedHeightInfo(bedHeight);
46 } 46 }
47 47
48 private BedHeightInfo(final BedHeight bedHeight) { 48 private BedHeightInfo(final BedHeight bedHeight) {
49 this.year = bedHeight.getYear(); 49 final Integer bhYear = bedHeight.getYear();
50 if (bhYear == null) {
51 // REMARK: this should never happen, as we do not allow the user to select bed heights without a year information
52 throw new IllegalArgumentException("bedHeight has no year");
53 }
54
55 this.year = bhYear;
50 this.description = bedHeight.getDescription(); 56 this.description = bedHeight.getDescription();
51 this.type = bedHeight.getType().getName(); 57 this.type = bedHeight.getType().getName();
52 this.evaluationBy = bedHeight.getEvaluationBy(); 58 this.evaluationBy = bedHeight.getEvaluationBy();
53 this.locationSystem = bedHeight.getLocationSystem().getName(); 59 this.locationSystem = bedHeight.getLocationSystem().getName();
54 this.curElevationModelUnit = bedHeight.getCurElevationModel().getUnit().getName(); 60 this.curElevationModelUnit = bedHeight.getCurElevationModel().getUnit().getName();

http://dive4elements.wald.intevation.org