/** * Returns a Percent instance representing the specified String value * * @param stringValue * a String value * @return return a Percent instance representing stringValue * @throws IllegalArgumentException if the given argument is not a valid Percent */ public static Percent valueOf(String stringValue) throws IllegalArgumentException { if ((stringValue == null) || (stringValue.length() == 0)) { return new Percent(0.0); } int n = stringValue.indexOf("%"); if (n != -1) { return new Percent(Double.valueOf(stringValue.substring(0, n)).doubleValue() / 100); } else { throw new IllegalArgumentException("parameter is invalid for datatype Percent"); } }
/** * Returns a Percent instance representing the specified String value * * @param stringValue * a String value * @return return a Percent instance representing stringValue * @throws IllegalArgumentException if the given argument is not a valid Percent */ public static Percent valueOf(String stringValue) throws IllegalArgumentException { if ((stringValue == null) || (stringValue.length() == 0)) { return new Percent(0.0); } int n = stringValue.indexOf("%"); if (n != -1) { return new Percent(Double.valueOf(stringValue.substring(0, n)).doubleValue() / 100); } else { throw new IllegalArgumentException("parameter is invalid for datatype Percent"); } }
/** * Returns a Percent instance representing the specified String value * * @param stringValue * a String value * @return return a Percent instance representing stringValue * @throws IllegalArgumentException if the given argument is not a valid Percent */ public static Percent valueOf(String stringValue) throws IllegalArgumentException { if ((stringValue == null) || (stringValue.length() == 0)) { return new Percent(0.0); } int n = stringValue.indexOf("%"); if (n != -1) { return new Percent(Double.valueOf(stringValue.substring(0, n)).doubleValue() / 100); } else { throw new IllegalArgumentException("parameter is invalid for datatype Percent"); } }