Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java @ 2128:bf67eb014443
Added convinience functions to FLYSArtifact and FLYSUtils.
flys-artifacts/trunk@3703 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 18 Jan 2012 09:29:12 +0000 |
parents | 85d31c2620e5 |
children | 79a94c4171cb |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java Tue Jan 17 18:26:45 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java Wed Jan 18 09:29:12 2012 +0000 @@ -589,6 +589,31 @@ /** * This method returns the value of a StateData object stored in the data + * pool of this Artifact as Long. + * + * @param name The name of the StateData object. + * + * @return a Long representing the value of the data object or null if + * no object was found for <i>name</i>. + * + * @throws NumberFormatException if the value of the data object could not + * be transformed into a Long. + */ + public Long getDataAsLong(String name) + throws NumberFormatException + { + String value = getDataAsString(name); + + if (value != null && value.length() > 0) { + return Long.parseLong(value); + } + + return null; + } + + + /** + * This method returns the value of a StateData object stored in the data * pool of this Artifact is Boolean using Boolean.valueOf(). * * @param name The name of the StateData object.