Java Code Examples for javax.xml.bind.DatatypeConverter#parseInteger()

The following examples show how to use javax.xml.bind.DatatypeConverter#parseInteger() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public Long getValue(XSFacet facet) {
	final XmlString value = facet.getValue();

	if (value == null) {
		return null;
	} else {
		final String v = value.value;

		if (v == null) {
			return null;
		} else {
			final BigInteger integerValue = DatatypeConverter.parseInteger(v);
			if (integerValue.compareTo(BigInteger
					.valueOf(Long.MAX_VALUE)) > 0) {
				return Long.MAX_VALUE;
			} else {
				return integerValue.longValue();
			}
		}
	}
}
 
Example 2
private BigInteger readFacet(String facetName,int offset) {
    XSFacet me = initiatingType.getFacet(facetName);
    if(me==null)
        return null;
    BigInteger bi = DatatypeConverter.parseInteger(me.getValue().value);
    if(offset!=0)
        bi = bi.add(BigInteger.valueOf(offset));
    return bi;
}
 
Example 3
private BigInteger readFacet(String facetName,int offset) {
    XSFacet me = initiatingType.getFacet(facetName);
    if(me==null)
        return null;
    BigInteger bi = DatatypeConverter.parseInteger(me.getValue().value);
    if(offset!=0)
        bi = bi.add(BigInteger.valueOf(offset));
    return bi;
}
 
Example 4
private BigInteger readFacet(String facetName,int offset) {
    XSFacet me = initiatingType.getFacet(facetName);
    if(me==null)
        return null;
    BigInteger bi = DatatypeConverter.parseInteger(me.getValue().value);
    if(offset!=0)
        bi = bi.add(BigInteger.valueOf(offset));
    return bi;
}
 
Example 5
private BigInteger readFacet(String facetName,int offset) {
    XSFacet me = initiatingType.getFacet(facetName);
    if(me==null)
        return null;
    BigInteger bi = DatatypeConverter.parseInteger(me.getValue().value);
    if(offset!=0)
        bi = bi.add(BigInteger.valueOf(offset));
    return bi;
}
 
Example 6
private BigInteger readFacet(String facetName,int offset) {
    XSFacet me = initiatingType.getFacet(facetName);
    if(me==null)
        return null;
    BigInteger bi = DatatypeConverter.parseInteger(me.getValue().value);
    if(offset!=0)
        bi = bi.add(BigInteger.valueOf(offset));
    return bi;
}
 
Example 7
private BigInteger readFacet(String facetName,int offset) {
    XSFacet me = initiatingType.getFacet(facetName);
    if(me==null)
        return null;
    BigInteger bi = DatatypeConverter.parseInteger(me.getValue().value);
    if(offset!=0)
        bi = bi.add(BigInteger.valueOf(offset));
    return bi;
}
 
Example 8
private BigInteger readFacet(String facetName,int offset) {
    XSFacet me = initiatingType.getFacet(facetName);
    if(me==null)
        return null;
    BigInteger bi = DatatypeConverter.parseInteger(me.getValue().value);
    if(offset!=0)
        bi = bi.add(BigInteger.valueOf(offset));
    return bi;
}
 
Example 9
private BigInteger readFacet(String facetName,int offset) {
    XSFacet me = initiatingType.getFacet(facetName);
    if(me==null)
        return null;
    BigInteger bi = DatatypeConverter.parseInteger(me.getValue().value);
    if(offset!=0)
        bi = bi.add(BigInteger.valueOf(offset));
    return bi;
}
 
Example 10
Source Project: OpenEstate-IO   File: ImmoXmlUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static BigInteger parseInteger(String value) {
    value = StringUtils.trimToNull(value);
    if (value == null) return null;
    try {
        return DatatypeConverter.parseInteger(value);
    } catch (NumberFormatException ex) {
        throw new IllegalArgumentException("Can't parse integer value '" + value + "'! " + ex.getLocalizedMessage());
    }
}
 
Example 11
Source Project: OpenEstate-IO   File: OpenImmoUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static BigInteger parseInteger(String value) {
    value = StringUtils.trimToNull(value);
    if (value == null) return null;
    try {
        return DatatypeConverter.parseInteger(value);
    } catch (NumberFormatException ex) {
        throw new IllegalArgumentException("Can't parse integer value '" + value + "'! " + ex.getLocalizedMessage());
    }
}
 
Example 12
Source Project: OpenEstate-IO   File: TrovitUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Read a {@link BigInteger} value from XML for a floor area.
 *
 * @param value XML string
 * @return parsed value or null, if the value is invalid
 */
public static BigInteger parseFloorAreaValue(String value) {
    try {
        value = StringUtils.trimToNull(value);
        return (value != null) ? DatatypeConverter.parseInteger(value) : null;
    } catch (NumberFormatException ex) {
        throw new IllegalArgumentException("Can't parse floor area value '" + value + "'!", ex);
    }
}
 
Example 13
Source Project: OpenEstate-IO   File: TrovitUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Read a {@link BigInteger} value from XML for a plot area.
 *
 * @param value XML string
 * @return parsed value or null, if the value is invalid
 */
public static BigInteger parsePlotAreaValue(String value) {
    try {
        value = StringUtils.trimToNull(value);
        return (value != null) ? DatatypeConverter.parseInteger(value) : null;
    } catch (NumberFormatException ex) {
        throw new IllegalArgumentException("Can't parse plot area value '" + value + "'!", ex);
    }
}
 
Example 14
Source Project: OpenEstate-IO   File: TrovitUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Read a {@link BigInteger} value from XML for a year number.
 *
 * @param value XML string
 * @return parsed value or null, if the value is invalid
 */
public static BigInteger parseYearValue(String value) {
    try {
        value = StringUtils.trimToNull(value);
        return (value != null) ? DatatypeConverter.parseInteger(value) : null;
    } catch (NumberFormatException ex) {
        throw new IllegalArgumentException("Can't parse year value '" + value + "'!", ex);
    }
}
 
Example 15
Source Project: java-client-api   File: ValueConverter.java    License: Apache License 2.0 4 votes vote down vote up
static public Object convertToJava(String type, String value) {
  if ("xs:anySimpleType".equals(type))
    return DatatypeConverter.parseAnySimpleType(value);
  if ("xs:base64Binary".equals(type))
    return DatatypeConverter.parseBase64Binary(value);
  if ("xs:boolean".equals(type)) return StringToBoolean(value);
  if ("xs:byte".equals(type))
    return DatatypeConverter.parseByte(value);
  if ("xs:date".equals(type))
    return DatatypeConverter.parseDate(value);
  if ("xs:dateTime".equals(type))
    return DatatypeConverter.parseDateTime(value);
  if ("xs:dayTimeDuration".equals(type))
    return Utilities.getDatatypeFactory().newDurationDayTime(value);
  if ("xs:decimal".equals(type))
    return DatatypeConverter.parseDecimal(value);
  if ("xs:double".equals(type)) return StringToDouble(value);
  if ("xs:duration".equals(type))
    return Utilities.getDatatypeFactory().newDuration(value);
  if ("xs:float".equals(type)) return StringToFloat(value);
  if ("xs:int".equals(type)) return StringToInteger(value);
  if ("xs:integer".equals(type))
    return DatatypeConverter.parseInteger(value);
  if ("xs:long".equals(type)) return StringToLong(value);
  if ("xs:short".equals(type))
    return DatatypeConverter.parseShort(value);
  if ("xs:string".equals(type))
    return DatatypeConverter.parseString(value);
  if ("xs:time".equals(type))
    return DatatypeConverter.parseTime(value);
  if ("xs:unsignedInt".equals(type))
    return DatatypeConverter.parseUnsignedInt(value);
  if ("xs:unsignedLong".equals(type)) {
    BigInteger bi = DatatypeConverter.parseInteger(value);
    if (bi.compareTo(MAX_UNSIGNED_LONG) < 0) {
      return bi.longValue();
    } else {
      return bi;
    }
  } if ("xs:unsignedShort".equals(type))
    return DatatypeConverter.parseUnsignedShort(value);
  if ("xs:yearMonthDuration".equals(type))
    return Utilities.getDatatypeFactory().newDurationYearMonth(value);
  return value;
}
 
Example 16
Source Project: OpenEstate-IO   File: WisItUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static BigInteger parsePositiveInteger(String value) {
    value = StringUtils.trimToNull(value);
    return (value != null) ? DatatypeConverter.parseInteger(value) : null;
}
 
Example 17
Source Project: OpenEstate-IO   File: DaftIeUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static BigInteger parsePositiveInteger(String value) {
    value = StringUtils.trimToNull(value);
    return (value != null) ? DatatypeConverter.parseInteger(value) : null;
}
 
Example 18
Source Project: OpenEstate-IO   File: KyeroUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static BigInteger parseInteger(String value) {
    value = StringUtils.trimToNull(value);
    return (value != null) ? DatatypeConverter.parseInteger(value) : null;
}
 
Example 19
Source Project: OpenEstate-IO   File: KyeroUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static BigInteger parseNonNegativeInteger(String value) {
    value = StringUtils.trimToNull(value);
    return (value != null) ? DatatypeConverter.parseInteger(value) : null;
}
 
Example 20
public static BigInteger parseInteger(String value) {
    value = StringUtils.trimToNull(value);
    return (value != null) ? DatatypeConverter.parseInteger(value) : null;
}