Java Code Examples for javax.xml.datatype.DatatypeConstants

The following examples show how to use javax.xml.datatype.DatatypeConstants. 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 want to check out the right sidebar which shows the related API usage.
Example 1
/**
 * <p>Constructs a new Duration object by specifying each field
 * individually.</p>
 *
 * <p>This method is functionally equivalent to
 * invoking another constructor by wrapping
 * all non-zero parameters into {@link BigInteger} and {@link BigDecimal}.
 * Zero value of int parameter is equivalent of null value of
 * the corresponding field.</p>
 *
 * @see #DurationImpl(boolean, BigInteger, BigInteger, BigInteger, BigInteger,
 *   BigInteger, BigDecimal)
 */
protected DurationImpl(
    final boolean isPositive,
    final int years,
    final int months,
    final int days,
    final int hours,
    final int minutes,
    final int seconds) {
    this(
        isPositive,
        wrap(years),
        wrap(months),
        wrap(days),
        wrap(hours),
        wrap(minutes),
        seconds != DatatypeConstants.FIELD_UNDEFINED ? new BigDecimal(String.valueOf(seconds)) : null);
}
 
Example 2
/**
 * Create a Java instance of XML Schema builtin datatype <code>time</code>.
 * @param hours number of hours
 * @param minutes number of minutes
 * @param seconds number of seconds
 * @param timezone offset in minutes. {@link DatatypeConstants#FIELD_UNDEFINED} indicates optional field is not set.
 *
 * @return <code>XMLGregorianCalendar</code> created from parameter values.
 *
 * @see DatatypeConstants#FIELD_UNDEFINED
 *
 * @throws IllegalArgumentException if any parameter is outside value
 * constraints for the field as specified in
 * <a href="#datetimefieldmapping">date/time field mapping table</a>.
 */
public static XMLGregorianCalendar createTime(
    int hours,
    int minutes,
    int seconds,
            int timezone) {

            return new XMLGregorianCalendarImpl(
                    DatatypeConstants.FIELD_UNDEFINED, // Year
                    DatatypeConstants.FIELD_UNDEFINED, // Month
                    DatatypeConstants.FIELD_UNDEFINED, // Day
                    hours,
                    minutes,
                    seconds,
                    DatatypeConstants.FIELD_UNDEFINED, //Millisecond
                    timezone);
}
 
Example 3
/**
 * <p>Implement Step B from
 * http://www.w3.org/TR/xmlschema-2/#dateTime-order.</p>
 */
private static int compareField(int Pfield, int Qfield) {
    if (Pfield == Qfield) {

        //fields are either equal in value or both undefined.
        // Step B. 1.1 AND optimized result of performing 1.1-1.4.
        return DatatypeConstants.EQUAL;
    } else {
        if (Pfield == DatatypeConstants.FIELD_UNDEFINED || Qfield == DatatypeConstants.FIELD_UNDEFINED) {
            // Step B. 1.2
            return DatatypeConstants.INDETERMINATE;
        } else {
            // Step B. 1.3-4.
            return (Pfield < Qfield ? DatatypeConstants.LESSER : DatatypeConstants.GREATER);
        }
    }
}
 
Example 4
private static int compareField(BigDecimal Pfield, BigDecimal Qfield) {
    // optimization. especially when both arguments are null.
    if (Pfield == Qfield) {
        return DatatypeConstants.EQUAL;
    }

    if (Pfield == null) {
        Pfield = DECIMAL_ZERO;
    }

    if (Qfield == null) {
        Qfield = DECIMAL_ZERO;
    }

    return Pfield.compareTo(Qfield);
}
 
Example 5
/**
 * <p>Normalize this instance to UTC.</p>
 *
 * <p>2000-03-04T23:00:00+03:00 normalizes to 2000-03-04T20:00:00Z</p>
 * <p>Implements W3C XML Schema Part 2, Section 3.2.7.3 (A).</p>
 */
public XMLGregorianCalendar normalize() {

    XMLGregorianCalendar normalized = normalizeToTimezone(timezone);

    // if timezone was undefined, leave it undefined
    if (getTimezone() == DatatypeConstants.FIELD_UNDEFINED) {
        normalized.setTimezone(DatatypeConstants.FIELD_UNDEFINED);
    }

    // if milliseconds was undefined, leave it undefined
    if (getMillisecond() == DatatypeConstants.FIELD_UNDEFINED) {
        normalized.setMillisecond(DatatypeConstants.FIELD_UNDEFINED);
    }

    return normalized;
}
 
Example 6
Source Project: jdk8u60   Source File: DurationImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * <p>Constructs a new Duration object by specifying each field
 * individually.</p>
 *
 * <p>This method is functionally equivalent to
 * invoking another constructor by wrapping
 * all non-zero parameters into {@link BigInteger} and {@link BigDecimal}.
 * Zero value of int parameter is equivalent of null value of
 * the corresponding field.</p>
 *
 * @see #DurationImpl(boolean, BigInteger, BigInteger, BigInteger, BigInteger,
 *   BigInteger, BigDecimal)
 */
protected DurationImpl(
    final boolean isPositive,
    final int years,
    final int months,
    final int days,
    final int hours,
    final int minutes,
    final int seconds) {
    this(
        isPositive,
        wrap(years),
        wrap(months),
        wrap(days),
        wrap(hours),
        wrap(minutes),
        seconds != DatatypeConstants.FIELD_UNDEFINED ? new BigDecimal(String.valueOf(seconds)) : null);
}
 
Example 7
Source Project: JDKSourceCode1.8   Source File: XMLGregorianCalendarImpl.java    License: MIT License 6 votes vote down vote up
/**
 * <p>Create a Java instance of XML Schema builtin datatype time.</p>
 *
 * @param hours number of hours
 * @param minutes number of minutes
 * @param seconds number of seconds
 * @param milliseconds number of milliseconds
 * @param timezone offset in minutes. {@link DatatypeConstants#FIELD_UNDEFINED} indicates optional field is not set.
 *
 * @return <code>XMLGregorianCalendar</code> created from parameter values.
 *
 * @see DatatypeConstants#FIELD_UNDEFINED
 *
 * @throws IllegalArgumentException if any parameter is outside value
 * constraints for the field as specified in
 * <a href="#datetimefieldmapping">date/time field mapping table</a>.
 */
public static XMLGregorianCalendar createTime(
    int hours,
    int minutes,
    int seconds,
    int milliseconds,
    int timezone) {

    return new XMLGregorianCalendarImpl(
            DatatypeConstants.FIELD_UNDEFINED, // year
            DatatypeConstants.FIELD_UNDEFINED, // month
            DatatypeConstants.FIELD_UNDEFINED, // day
            hours,
            minutes,
            seconds,
            milliseconds,
            timezone);
}
 
Example 8
/**
 * <p>Gets the value of the field as a {@link BigDecimal}.</p>
 *
 * <p>If the field is unset, return 0.</p>
 *
 * @param f Field to get value for.
 *
 * @return  non-null valid {@link BigDecimal}.
 */
private BigDecimal getFieldAsBigDecimal(DatatypeConstants.Field f) {
    if (f == DatatypeConstants.SECONDS) {
        if (seconds != null) {
            return seconds;
        } else {
            return ZERO;
        }
    } else {
        BigInteger bi = (BigInteger) getField(f);
        if (bi == null) {
            return ZERO;
        } else {
            return new BigDecimal(bi);
        }
    }
}
 
Example 9
/**
 * <p>Create a Java instance of XML Schema builtin datatype time.</p>
 *
 * @param hours number of hours
 * @param minutes number of minutes
 * @param seconds number of seconds
 * @param fractionalSecond value of <code>null</code> indicates that this optional field is not set.
 * @param timezone offset in minutes. {@link DatatypeConstants#FIELD_UNDEFINED} indicates optional field is not set.
 *
 * @return <code>XMLGregorianCalendar</code> created from parameter values.
 *
 * @see DatatypeConstants#FIELD_UNDEFINED
 *
 * @throws IllegalArgumentException if any parameter is outside value
 * constraints for the field as specified in
 * <a href="#datetimefieldmapping">date/time field mapping table</a>.
 */
public static XMLGregorianCalendar createTime(
    int hours,
    int minutes,
    int seconds,
    BigDecimal fractionalSecond,
    int timezone) {

    return new XMLGregorianCalendarImpl(
        null,            // Year
        DatatypeConstants.FIELD_UNDEFINED, // month
        DatatypeConstants.FIELD_UNDEFINED, // day
        hours,
        minutes,
        seconds,
        fractionalSecond,
        timezone);
}
 
Example 10
Source Project: TencentKona-8   Source File: DurationImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * <p>Constructs a new Duration object by specifying each field
 * individually.</p>
 *
 * <p>This method is functionally equivalent to
 * invoking another constructor by wrapping
 * all non-zero parameters into {@link BigInteger} and {@link BigDecimal}.
 * Zero value of int parameter is equivalent of null value of
 * the corresponding field.</p>
 *
 * @see #DurationImpl(boolean, BigInteger, BigInteger, BigInteger, BigInteger,
 *   BigInteger, BigDecimal)
 */
protected DurationImpl(
    final boolean isPositive,
    final int years,
    final int months,
    final int days,
    final int hours,
    final int minutes,
    final int seconds) {
    this(
        isPositive,
        wrap(years),
        wrap(months),
        wrap(days),
        wrap(hours),
        wrap(minutes),
        seconds != DatatypeConstants.FIELD_UNDEFINED ? new BigDecimal(String.valueOf(seconds)) : null);
}
 
Example 11
/**
 * <p>Return XML Schema 1.0 dateTime datatype field for
 * <code>year</code>.</p>
 *
 * <p>Value constraints for this value are summarized in
 * <a href="#datetimefield-year">year field of date/time field mapping table</a>.</p>
 *
 * @return sum of <code>eon</code> and <code>BigInteger.valueOf(year)</code>
 * when both fields are defined. When only <code>year</code> is defined,
 * return it. When both <code>eon</code> and <code>year</code> are not
 * defined, return <code>null</code>.
 *
 * @see #getEon()
 * @see #getYear()
 */
public BigInteger getEonAndYear() {

            // both are defined
            if (year != DatatypeConstants.FIELD_UNDEFINED
                    && eon != null) {

                    return eon.add(BigInteger.valueOf((long) year));
            }

            // only year is defined
            if (year != DatatypeConstants.FIELD_UNDEFINED
                    && eon == null) {

                    return BigInteger.valueOf((long) year);
            }

    // neither are defined
    // or only eon is defined which is not valid without a year
            return null;
}
 
Example 12
/**
 * <p>Create a Java instance of XML Schema builtin datatype time.</p>
 *
 * @param hours number of hours
 * @param minutes number of minutes
 * @param seconds number of seconds
 * @param fractionalSecond value of <code>null</code> indicates that this optional field is not set.
 * @param timezone offset in minutes. {@link DatatypeConstants#FIELD_UNDEFINED} indicates optional field is not set.
 *
 * @return <code>XMLGregorianCalendar</code> created from parameter values.
 *
 * @see DatatypeConstants#FIELD_UNDEFINED
 *
 * @throws IllegalArgumentException if any parameter is outside value
 * constraints for the field as specified in
 * <a href="#datetimefieldmapping">date/time field mapping table</a>.
 */
public static XMLGregorianCalendar createTime(
    int hours,
    int minutes,
    int seconds,
    BigDecimal fractionalSecond,
    int timezone) {

    return new XMLGregorianCalendarImpl(
        null,            // Year
        DatatypeConstants.FIELD_UNDEFINED, // month
        DatatypeConstants.FIELD_UNDEFINED, // day
        hours,
        minutes,
        seconds,
        fractionalSecond,
        timezone);
}
 
Example 13
/**
 * <p>Create a Java instance of XML Schema builtin datatype time.</p>
 *
 * @param hours number of hours
 * @param minutes number of minutes
 * @param seconds number of seconds
 * @param milliseconds number of milliseconds
 * @param timezone offset in minutes. {@link DatatypeConstants#FIELD_UNDEFINED} indicates optional field is not set.
 *
 * @return <code>XMLGregorianCalendar</code> created from parameter values.
 *
 * @see DatatypeConstants#FIELD_UNDEFINED
 *
 * @throws IllegalArgumentException if any parameter is outside value
 * constraints for the field as specified in
 * <a href="#datetimefieldmapping">date/time field mapping table</a>.
 */
public static XMLGregorianCalendar createTime(
    int hours,
    int minutes,
    int seconds,
    int milliseconds,
    int timezone) {

    return new XMLGregorianCalendarImpl(
            DatatypeConstants.FIELD_UNDEFINED, // year
            DatatypeConstants.FIELD_UNDEFINED, // month
            DatatypeConstants.FIELD_UNDEFINED, // day
            hours,
            minutes,
            seconds,
            milliseconds,
            timezone);
}
 
Example 14
/**
 * <p>Create a Java instance of XML Schema builtin datatype dateTime.</p>
 *
 * @param year represents both high-order eons and low-order year.
 * @param month of <code>dateTime</code>
 * @param day of <code>dateTime</code>
 * @param hour of <code>dateTime</code>
 * @param minute of <code>dateTime</code>
 * @param second of <code>dateTime</code>
 *
 * @return <code>XMLGregorianCalendar</code> created from parameter values.
 *
 * @throws IllegalArgumentException if any parameter is outside value constraints for the field as specified in
 *   <a href="#datetimefieldmapping">date/time field mapping table</a>.
 *
 * @see DatatypeConstants#FIELD_UNDEFINED
 */
public static XMLGregorianCalendar createDateTime(
    int year,
    int month,
    int day,
    int hour,
    int minute,
    int second) {

    return new XMLGregorianCalendarImpl(
        year,
        month,
        day,
        hour,
        minute,
        second,
        DatatypeConstants.FIELD_UNDEFINED,  //millisecond
            DatatypeConstants.FIELD_UNDEFINED //timezone
    );
}
 
Example 15
Source Project: hottub   Source File: DurationImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * <p>Gets the value of the field as a {@link BigDecimal}.</p>
 *
 * <p>If the field is unset, return 0.</p>
 *
 * @param f Field to get value for.
 *
 * @return  non-null valid {@link BigDecimal}.
 */
private BigDecimal getFieldAsBigDecimal(DatatypeConstants.Field f) {
    if (f == DatatypeConstants.SECONDS) {
        if (seconds != null) {
            return seconds;
        } else {
            return ZERO;
        }
    } else {
        BigInteger bi = (BigInteger) getField(f);
        if (bi == null) {
            return ZERO;
        } else {
            return new BigDecimal(bi);
        }
    }
}
 
Example 16
/**
 * <p>Set year of XSD <code>dateTime</code> year field.</p>
 *
 * <p>Unset this field by invoking the setter with a parameter value of
 * {@link DatatypeConstants#FIELD_UNDEFINED}.</p>
 *
 * <p>Note: if the absolute value of the <code>year</code> parameter
 * is less than 10^9, the eon component of the XSD year field is set to
 * <code>null</code> by this method.</p>
 *
 * @param year value constraints are summarized in <a href="#datetimefield-year">year field of date/time field mapping table</a>.
 *   If year is {@link DatatypeConstants#FIELD_UNDEFINED}, then eon is set to <code>null</code>.
 */
public void setYear(int year) {
    if (year == DatatypeConstants.FIELD_UNDEFINED) {
        this.year = DatatypeConstants.FIELD_UNDEFINED;
        this.eon = null;
    }
    else if (Math.abs(year) < BILLION_I) {
        this.year = year;
        this.eon = null;
    } else {
        BigInteger theYear = BigInteger.valueOf((long) year);
        BigInteger remainder = theYear.remainder(BILLION_B);
        this.year = remainder.intValue();
        setEon(theYear.subtract(remainder));
    }
}
 
Example 17
Source Project: sis   Source File: GO_DateTime.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Builds a wrapper for the given {@link Date}.
 *
 * @param date  the date to marshal. Can not be {@code null}.
 */
private GO_DateTime(final Date date) {
    final Context context = Context.current();
    try {
        final XMLGregorianCalendar gc = XmlUtilities.toXML(context, date);
        if (Context.isFlagSet(context, Context.LEGACY_METADATA)) {
            if (XmlUtilities.trimTime(gc, false)) {
                this.date = gc;
            } else {
                dateTime = gc;
            }
        } else {
            if (gc.getMillisecond() == 0) {
                gc.setMillisecond(DatatypeConstants.FIELD_UNDEFINED);
            }
            dateTime = gc;
        }
    } catch (DatatypeConfigurationException e) {
        Context.warningOccured(context, XmlAdapter.class, "marshal", e, true);
    }
}
 
Example 18
/**
 * <p>Normalize this instance to UTC.</p>
 *
 * <p>2000-03-04T23:00:00+03:00 normalizes to 2000-03-04T20:00:00Z</p>
 * <p>Implements W3C XML Schema Part 2, Section 3.2.7.3 (A).</p>
 */
public XMLGregorianCalendar normalize() {

    XMLGregorianCalendar normalized = normalizeToTimezone(timezone);

    // if timezone was undefined, leave it undefined
    if (getTimezone() == DatatypeConstants.FIELD_UNDEFINED) {
        normalized.setTimezone(DatatypeConstants.FIELD_UNDEFINED);
    }

    // if milliseconds was undefined, leave it undefined
    if (getMillisecond() == DatatypeConstants.FIELD_UNDEFINED) {
        normalized.setMillisecond(DatatypeConstants.FIELD_UNDEFINED);
    }

    return normalized;
}
 
Example 19
/**
 * <p>Implement Step B from
 * http://www.w3.org/TR/xmlschema-2/#dateTime-order.</p>
 */
private static int compareField(int Pfield, int Qfield) {
    if (Pfield == Qfield) {

        //fields are either equal in value or both undefined.
        // Step B. 1.1 AND optimized result of performing 1.1-1.4.
        return DatatypeConstants.EQUAL;
    } else {
        if (Pfield == DatatypeConstants.FIELD_UNDEFINED || Qfield == DatatypeConstants.FIELD_UNDEFINED) {
            // Step B. 1.2
            return DatatypeConstants.INDETERMINATE;
        } else {
            // Step B. 1.3-4.
            return (Pfield < Qfield ? DatatypeConstants.LESSER : DatatypeConstants.GREATER);
        }
    }
}
 
Example 20
/**
 * <p>Create a Java instance of XML Schema builtin datatype time.</p>
 *
 * @param hours number of hours
 * @param minutes number of minutes
 * @param seconds number of seconds
 * @param milliseconds number of milliseconds
 * @param timezone offset in minutes. {@link DatatypeConstants#FIELD_UNDEFINED} indicates optional field is not set.
 *
 * @return <code>XMLGregorianCalendar</code> created from parameter values.
 *
 * @see DatatypeConstants#FIELD_UNDEFINED
 *
 * @throws IllegalArgumentException if any parameter is outside value
 * constraints for the field as specified in
 * <a href="#datetimefieldmapping">date/time field mapping table</a>.
 */
public static XMLGregorianCalendar createTime(
    int hours,
    int minutes,
    int seconds,
    int milliseconds,
    int timezone) {

    return new XMLGregorianCalendarImpl(
            DatatypeConstants.FIELD_UNDEFINED, // year
            DatatypeConstants.FIELD_UNDEFINED, // month
            DatatypeConstants.FIELD_UNDEFINED, // day
            hours,
            minutes,
            seconds,
            milliseconds,
            timezone);
}
 
Example 21
Source Project: jdmn   Source File: FEELXMLGregorianCalendar.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public QName getXMLSchemaType() {
    int mask =
            (year != DatatypeConstants.FIELD_UNDEFINED ? 0x20 : 0) |
                    (month != DatatypeConstants.FIELD_UNDEFINED ? 0x10 : 0) |
                    (day != DatatypeConstants.FIELD_UNDEFINED ? 0x08 : 0) |
                    (hour != DatatypeConstants.FIELD_UNDEFINED ? 0x04 : 0) |
                    (minute != DatatypeConstants.FIELD_UNDEFINED ? 0x02 : 0) |
                    (second != DatatypeConstants.FIELD_UNDEFINED ? 0x01 : 0);
    switch (mask) {
        case 0x3F:
            return DatatypeConstants.DATETIME;
        case 0x38:
            return DatatypeConstants.DATE;
        case 0x07:
            return DatatypeConstants.TIME;
        default:
            throw new IllegalStateException(
                    errorMessage("InvalidXGCFields", new Object[] {this.getClass().getName() + "#getXMLSchemaType() :"})
            );
    }
}
 
Example 22
/**
 * <p>Unset all fields to undefined.</p>
 *
 * <p>Set all int fields to {@link DatatypeConstants#FIELD_UNDEFINED} and reference fields
 * to null.</p>
 */
public void clear() {
    eon = null;
    year = DatatypeConstants.FIELD_UNDEFINED;
    month = DatatypeConstants.FIELD_UNDEFINED;
    day = DatatypeConstants.FIELD_UNDEFINED;
    timezone = DatatypeConstants.FIELD_UNDEFINED;  // in minutes
    hour = DatatypeConstants.FIELD_UNDEFINED;
    minute = DatatypeConstants.FIELD_UNDEFINED;
    second = DatatypeConstants.FIELD_UNDEFINED;
    fractionalSecond = null;
}
 
Example 23
Source Project: Bytecoder   Source File: DurationImpl.java    License: Apache License 2.0 5 votes vote down vote up
/**
     * TODO: Javadoc
     *
     * @param i int to convert to BigInteger.
     *
     * @return BigInteger representation of int.
     */
protected static BigInteger wrap(final int i) {

    // field may not be set
    if (i == DatatypeConstants.FIELD_UNDEFINED) {
            return null;
    }

    // int -> BigInteger
    return BigInteger.valueOf(i);
}
 
Example 24
Source Project: openjdk-jdk8u   Source File: DurationImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>Makes sure that the given number is non-negative. If it is not,
 * throw {@link IllegalArgumentException}.</p>
 *
 * @param n Number to test.
 * @param f Field to test.
 */
protected static void testNonNegative(BigDecimal n, DatatypeConstants.Field f) {
    if (n != null && n.signum() < 0) {

        throw new IllegalArgumentException(
            DatatypeMessageFormatter.formatMessage(null, "NegativeField", new Object[]{f.toString()})
        );
    }
}
 
Example 25
Source Project: openjdk-jdk9   Source File: DurationImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>Constructs a new Duration object by specifying each field individually.</p>
 *
 * <p>All the parameters are optional as long as at least one field is present.
 * If specified, parameters have to be zero or positive.</p>
 *
 * @param isPositive Set to <code>false</code> to create a negative duration. When the length
 *   of the duration is zero, this parameter will be ignored.
 * @param years of this <code>Duration</code>
 * @param months of this <code>Duration</code>
 * @param days of this <code>Duration</code>
 * @param hours of this <code>Duration</code>
 * @param minutes of this <code>Duration</code>
 * @param seconds of this <code>Duration</code>
 *
 * @throws IllegalArgumentException
 *    If years, months, days, hours, minutes and
 *    seconds parameters are all <code>null</code>. Or if any
 *    of those parameters are negative.
 */
protected DurationImpl(
    boolean isPositive,
    BigInteger years,
    BigInteger months,
    BigInteger days,
    BigInteger hours,
    BigInteger minutes,
    BigDecimal seconds) {

    this.years = years;
    this.months = months;
    this.days = days;
    this.hours = hours;
    this.minutes = minutes;
    this.seconds = seconds;

    this.signum = calcSignum(isPositive);

    // sanity check
    if (years == null
        && months == null
        && days == null
        && hours == null
        && minutes == null
        && seconds == null) {
        throw new IllegalArgumentException(
        //"all the fields are null"
        DatatypeMessageFormatter.formatMessage(null, "AllFieldsNull", null)
        );
    }
    testNonNegative(years, DatatypeConstants.YEARS);
    testNonNegative(months, DatatypeConstants.MONTHS);
    testNonNegative(days, DatatypeConstants.DAYS);
    testNonNegative(hours, DatatypeConstants.HOURS);
    testNonNegative(minutes, DatatypeConstants.MINUTES);
    testNonNegative(seconds, DatatypeConstants.SECONDS);
}
 
Example 26
protected XMLGregorianCalendar genTaxYear(int year) {
	XMLGregorianCalendar taxyear = new XMLGregorianCalendarImpl(new GregorianCalendar());
	taxyear.setTimezone(DatatypeConstants.FIELD_UNDEFINED);
	taxyear.setTime(DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED);
	taxyear.setDay(DatatypeConstants.FIELD_UNDEFINED);
	taxyear.setMonth(DatatypeConstants.FIELD_UNDEFINED);
	taxyear.setYear(year);
	return taxyear;
}
 
Example 27
private static int compareField(BigInteger Pfield, BigInteger Qfield) {
    if (Pfield == null) {
        return (Qfield == null ? DatatypeConstants.EQUAL : DatatypeConstants.INDETERMINATE);
    }
    if (Qfield == null) {
        return DatatypeConstants.INDETERMINATE;
    }
    return Pfield.compareTo(Qfield);
}
 
Example 28
/**
 * <p>Indicates whether parameter <code>obj</code> is "equal to" this one.</p>
 *
 * @param obj to compare.
 *
 * @return <code>true</code> when <code>compare(this,(XMLGregorianCalendar)obj) == EQUAL.</code>.
 */
public boolean equals(Object obj) {

    if (obj == null || !(obj instanceof XMLGregorianCalendar)) {
        return false;
    }
    return compare((XMLGregorianCalendar) obj) == DatatypeConstants.EQUAL;
}
 
Example 29
/**
 * <p>Unset all fields to undefined.</p>
 *
 * <p>Set all int fields to {@link DatatypeConstants#FIELD_UNDEFINED} and reference fields
 * to null.</p>
 */
public void clear() {
    eon = null;
    year = DatatypeConstants.FIELD_UNDEFINED;
    month = DatatypeConstants.FIELD_UNDEFINED;
    day = DatatypeConstants.FIELD_UNDEFINED;
    timezone = DatatypeConstants.FIELD_UNDEFINED;  // in minutes
    hour = DatatypeConstants.FIELD_UNDEFINED;
    minute = DatatypeConstants.FIELD_UNDEFINED;
    second = DatatypeConstants.FIELD_UNDEFINED;
    fractionalSecond = null;
}
 
Example 30
Source Project: openjdk-jdk9   Source File: DurationImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
     * TODO: Javadoc
     *
     * @param i int to convert to BigInteger.
     *
     * @return BigInteger representation of int.
     */
protected static BigInteger wrap(final int i) {

    // field may not be set
    if (i == DatatypeConstants.FIELD_UNDEFINED) {
            return null;
    }

    // int -> BigInteger
    return BigInteger.valueOf(i);
}