javax.xml.datatype.DatatypeConstants Java Examples
The following examples show how to use
javax.xml.datatype.DatatypeConstants.
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
Source File: XMLGregorianCalendarImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * <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 #2
Source File: FEELXMLGregorianCalendar.java From jdmn with Apache License 2.0 | 6 votes |
@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 #3
Source File: DurationImpl.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * <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 #4
Source File: XMLGregorianCalendarImpl.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * <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 #5
Source File: XMLGregorianCalendarImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
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 #6
Source File: XMLGregorianCalendarImpl.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * <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 #7
Source File: XMLGregorianCalendarImpl.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * <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 #8
Source File: XMLGregorianCalendarImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * 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 #9
Source File: XMLGregorianCalendarImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * <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 #10
Source File: DurationImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * <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
Source File: XMLGregorianCalendarImpl.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * <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 #12
Source File: XMLGregorianCalendarImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * <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 #13
Source File: GO_DateTime.java From sis with Apache License 2.0 | 6 votes |
/** * 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 #14
Source File: DurationImpl.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * <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 #15
Source File: XMLGregorianCalendarImpl.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * <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 #16
Source File: DurationImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * <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 #17
Source File: XMLGregorianCalendarImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * <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 #18
Source File: XMLGregorianCalendarImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * <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 #19
Source File: XMLGregorianCalendarImpl.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * <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 #20
Source File: XMLGregorianCalendarImpl.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * <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 #21
Source File: DurationImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * <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 #22
Source File: DurationDayTimeImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public DurationDayTimeImpl( boolean isPositive, int days, int hours, int minutes, int seconds) { this( isPositive, wrap(days), wrap(hours), wrap(minutes), (seconds != DatatypeConstants.FIELD_UNDEFINED ? new BigDecimal(String.valueOf(seconds)) : null)); }
Example #23
Source File: XMLGregorianCalendarImpl.java From JDKSourceCode1.8 with MIT License | 5 votes |
public void setMillisecond(int millisecond) { if (millisecond == DatatypeConstants.FIELD_UNDEFINED) { fractionalSecond = null; } else { if(millisecond<0 || 999<millisecond) if(millisecond!=DatatypeConstants.FIELD_UNDEFINED) invalidFieldValue(MILLISECOND, millisecond); fractionalSecond = new BigDecimal((long) millisecond).movePointLeft(3); } }
Example #24
Source File: XMLGregorianCalendarImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * <p>Return the lexical representation of <code>this</code> instance. * The format is specified in * <a href="http://www.w3.org/TR/xmlschema-2/#dateTime-order">XML Schema 1.0 Part 2, Section 3.2.[7-14].1, * <i>Lexical Representation</i>".</a></p> * * <p>Specific target lexical representation format is determined by * {@link #getXMLSchemaType()}.</p> * * @return XML, as <code>String</code>, representation of this <code>XMLGregorianCalendar</code> * * @throws java.lang.IllegalStateException if the combination of set fields * does not match one of the eight defined XML Schema builtin date/time datatypes. */ public String toXMLFormat() { QName typekind = getXMLSchemaType(); String formatString = null; // Fix 4971612: invalid SCCS macro substitution in data string // no %{alpha}% to avoid SCCS macro substitution if (typekind == DatatypeConstants.DATETIME) { formatString = "%Y-%M-%DT%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.DATE) { formatString = "%Y-%M-%D" + "%z"; } else if (typekind == DatatypeConstants.TIME) { formatString = "%h:%m:%s" + "%z"; } else if (typekind == DatatypeConstants.GMONTH) { formatString = "--%M" + "%z"; } else if (typekind == DatatypeConstants.GDAY) { formatString = "---%D" + "%z"; } else if (typekind == DatatypeConstants.GYEAR) { formatString = "%Y" + "%z"; } else if (typekind == DatatypeConstants.GYEARMONTH) { formatString = "%Y-%M" + "%z"; } else if (typekind == DatatypeConstants.GMONTHDAY) { formatString = "--%M-%D" + "%z"; } return format(formatString); }
Example #25
Source File: XmlCteUtil.java From Java_CTe with MIT License | 5 votes |
public static String dataCte(LocalDateTime dataASerFormatada, ZoneId zoneId) { try { GregorianCalendar calendar = GregorianCalendar.from(dataASerFormatada.atZone(ObjetoCTeUtil.verifica(zoneId).orElse(ZoneId.of("Brazil/East")))); XMLGregorianCalendar xmlCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar); xmlCalendar.setMillisecond(DatatypeConstants.FIELD_UNDEFINED); return xmlCalendar.toString(); } catch (DatatypeConfigurationException e) { LoggerUtil.log(XmlCteUtil.class, e.getMessage()); } return null; }
Example #26
Source File: SwingJideClockWidget.java From atdl4j with MIT License | 5 votes |
/** * Used when applying Clock@initValue (xs:time) * @param aValue * @param @InitValueMode */ protected void setAndRenderInitValue( XMLGregorianCalendar aValue, int aInitValueMode ) { if ( aValue != null ) { // -- Note that this will throw IllegalArgumentException if timezone ID // specified cannot be resolved -- DateTimeZone tempLocalMktTz = getLocalMktTz(); logger.debug( "control.getID(): " + control.getID() + " aValue: " + aValue + " getLocalMktTz(): " + tempLocalMktTz ); // -- localMktTz is required when using/interpreting aValue -- if ( tempLocalMktTz == null ) { throw new IllegalArgumentException( "localMktTz is required when aValue (" + aValue + ") is specified. (Control.ID: " + control.getID() + ")" ); } DateTime tempNow = new DateTime( tempLocalMktTz ); DateTime tempInit = new DateTime( ( showMonthYear && aValue.getYear() != DatatypeConstants.FIELD_UNDEFINED ) ? aValue.getYear() : tempNow.getYear(), ( showMonthYear && aValue.getMonth() != DatatypeConstants.FIELD_UNDEFINED ) ? aValue.getMonth() : tempNow.getMonthOfYear(), ( showMonthYear && aValue.getDay() != DatatypeConstants.FIELD_UNDEFINED ) ? aValue.getDay() : tempNow.getDayOfMonth(), ( showTime && aValue.getHour() != DatatypeConstants.FIELD_UNDEFINED ) ? aValue.getHour() : 0, ( showTime && aValue.getMinute() != DatatypeConstants.FIELD_UNDEFINED ) ? aValue.getMinute() : 0, ( showTime && aValue.getSecond() != DatatypeConstants.FIELD_UNDEFINED ) ? aValue.getSecond(): 0, 0, tempLocalMktTz ); if ( ( aInitValueMode == Atdl4jConstants.CLOCK_INIT_VALUE_MODE_USE_CURRENT_TIME_IF_LATER ) && ( tempNow.isAfter( tempInit ) ) ) { // -- Use current time -- tempInit = tempNow; } // -- Make sure that the value is rendered on the display in local timezone -- setValue( tempInit.withZone( DateTimeZone.getDefault() ) ); } }
Example #27
Source File: YearMonthDurationDV.java From JDKSourceCode1.8 with MIT License | 5 votes |
protected Duration getDuration(DateTimeData date) { int sign = 1; if ( date.year<0 || date.month<0) { sign = -1; } return datatypeFactory.newDuration(sign == 1, date.year != DatatypeConstants.FIELD_UNDEFINED?BigInteger.valueOf(sign*date.year):null, date.month != DatatypeConstants.FIELD_UNDEFINED?BigInteger.valueOf(sign*date.month):null, null, null, null, null); }
Example #28
Source File: YearMonthDurationDV.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
protected Duration getDuration(DateTimeData date) { int sign = 1; if ( date.year<0 || date.month<0) { sign = -1; } return datatypeFactory.newDuration(sign == 1, date.year != DatatypeConstants.FIELD_UNDEFINED?BigInteger.valueOf(sign*date.year):null, date.month != DatatypeConstants.FIELD_UNDEFINED?BigInteger.valueOf(sign*date.month):null, null, null, null, null); }
Example #29
Source File: FEELXMLGregorianCalendar.java From jdmn with Apache License 2.0 | 5 votes |
@Override public void setMinute(int minute) { if (minute < 0 || 59 < minute) if (minute != DatatypeConstants.FIELD_UNDEFINED) invalidFieldValue(MINUTE, minute); this.minute = minute; }
Example #30
Source File: XMLGregorianCalendarImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static int maximumDayInMonthFor(int year, int month) { if (month != DatatypeConstants.FEBRUARY) { return daysInMonth[month]; } else { if (((year % 400) == 0) || (((year % 100) != 0) && ((year % 4) == 0))) { // is a leap year. return 29; } else { return daysInMonth[DatatypeConstants.FEBRUARY]; } } }