當前位置: 首頁>>代碼示例>>Java>>正文


Java DatatypeMessageFormatter類代碼示例

本文整理匯總了Java中org.apache.xerces.util.DatatypeMessageFormatter的典型用法代碼示例。如果您正苦於以下問題:Java DatatypeMessageFormatter類的具體用法?Java DatatypeMessageFormatter怎麽用?Java DatatypeMessageFormatter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DatatypeMessageFormatter類屬於org.apache.xerces.util包,在下文中一共展示了DatatypeMessageFormatter類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: checkFieldValueConstraint

import org.apache.xerces.util.DatatypeMessageFormatter; //導入依賴的package包/類
private void checkFieldValueConstraint(int field, int value)
    throws IllegalArgumentException {
    if ((value < MIN_FIELD_VALUE[field] && value != DatatypeConstants.FIELD_UNDEFINED) ||
            value > MAX_FIELD_VALUE[field]) {
        /**
        throw new IllegalArgumentException("invalid value " + value +
	       " for " + FIELD_NAME[field] +
	       " field");
         */
        throw new IllegalArgumentException(
                DatatypeMessageFormatter.formatMessage(null, "InvalidFieldValue", new Object[]{ new Integer(value), FIELD_NAME[field]})
        );
    }
}
 
開發者ID:MirrorIP,項目名稱:msf-spaces-sdk-android,代碼行數:15,代碼來源:XMLGregorianCalendarImpl.java

示例2: setFractionalSecond

import org.apache.xerces.util.DatatypeMessageFormatter; //導入依賴的package包/類
public void setFractionalSecond(BigDecimal fractional) {
    if (fractional != null) {
        if ((fractional.compareTo(DECIMAL_ZERO) < 0) ||
                (fractional.compareTo(DECIMAL_ONE) > 0)) {
            throw new IllegalArgumentException(DatatypeMessageFormatter.formatMessage(null, 
                    "InvalidFractional", new Object[]{fractional}));
        }            	                             
    }
    this.fractionalSecond = fractional;
}
 
開發者ID:MirrorIP,項目名稱:msf-spaces-sdk-android,代碼行數:11,代碼來源:XMLGregorianCalendarImpl.java

示例3: DurationImpl

import org.apache.xerces.util.DatatypeMessageFormatter; //導入依賴的package包/類
/**
 * <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);
}
 
開發者ID:MirrorIP,項目名稱:msf-spaces-sdk-android,代碼行數:58,代碼來源:DurationImpl.java

示例4: testNonNegative

import org.apache.xerces.util.DatatypeMessageFormatter; //導入依賴的package包/類
/**
 * <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.
 */
private static void testNonNegative(BigInteger n, DatatypeConstants.Field f) {
    if (n != null && n.signum() < 0) {
        throw new IllegalArgumentException(             
            DatatypeMessageFormatter.formatMessage(null, "NegativeField", new Object[]{f.toString()})
        );
    }
}
 
開發者ID:MirrorIP,項目名稱:msf-spaces-sdk-android,代碼行數:15,代碼來源:DurationImpl.java

示例5: checkFieldValueConstraint

import org.apache.xerces.util.DatatypeMessageFormatter; //導入依賴的package包/類
private void checkFieldValueConstraint(int field, int value)
throws IllegalArgumentException 
   {
if ((value < MIN_FIELD_VALUE[field] && value != DatatypeConstants.FIELD_UNDEFINED) ||
    value > MAX_FIELD_VALUE[field]) {
        /**
           throw new IllegalArgumentException("invalid value " + value +
				       " for " + FIELD_NAME[field] +
				       " field");
            */
       throw new IllegalArgumentException(
           DatatypeMessageFormatter.formatMessage(null, "InvalidFieldValue", new Object[]{ new Integer(value), FIELD_NAME[field]})
       );
}
   }
 
開發者ID:edlectrico,項目名稱:Pellet4Android,代碼行數:16,代碼來源:XMLGregorianCalendarImpl.java

示例6: setFractionalSecond

import org.apache.xerces.util.DatatypeMessageFormatter; //導入依賴的package包/類
public void setFractionalSecond(BigDecimal fractional) {
if (fractional != null) {
    if ((fractional.compareTo(DECIMAL_ZERO) < 0) ||
	(fractional.compareTo(DECIMAL_ONE) > 0)) {
	throw new IllegalArgumentException(DatatypeMessageFormatter.formatMessage(null, 
           "InvalidFractional", new Object[]{fractional}));
    }            	                             
}
this.fractionalSecond = fractional;
   }
 
開發者ID:edlectrico,項目名稱:Pellet4Android,代碼行數:11,代碼來源:XMLGregorianCalendarImpl.java

示例7: XMLGregorianCalendarImpl

import org.apache.xerces.util.DatatypeMessageFormatter; //導入依賴的package包/類
/**
   * <p>Private constructor allowing for complete value spaces allowed by 
   * W3C XML Schema 1.0 recommendation for xsd:dateTime and related 
   * builtin datatypes. Note that <code>year</code> parameter supports
   * arbitrarily large numbers and fractionalSecond has infinite 
   * precision.</p>
   * 
   * @param year of <code>XMLGregorianCalendar</code> to be created.
   * @param month of <code>XMLGregorianCalendar</code> to be created.
   * @param day of <code>XMLGregorianCalendar</code> to be created.
   * @param hour of <code>XMLGregorianCalendar</code> to be created.
   * @param minute of <code>XMLGregorianCalendar</code> to be created.
   * @param second of <code>XMLGregorianCalendar</code> to be created.
   * @param fractionalSecond of <code>XMLGregorianCalendar</code> to be created.
   * @param timezone of <code>XMLGregorianCalendar</code> to be created.
   * 
   */
  protected XMLGregorianCalendarImpl(
      BigInteger year,
      int month,
      int day,
      int hour,
      int minute,
      int second,
      BigDecimal fractionalSecond,
      int timezone) {
      	
setYear(year);
      setMonth(month);
      setDay(day);
      setTime(hour, minute, second, fractionalSecond);
setTimezone(timezone);

// check for validity
if (!isValid()) {
	
          throw new IllegalArgumentException(
              DatatypeMessageFormatter.formatMessage(null, 
                  "InvalidXGCValue-fractional", 
                  new Object[] { year, new Integer(month), new Integer(day), 
                  new Integer(hour), new Integer(minute), new Integer(second),
                  fractionalSecond, new Integer(timezone)})
	);
                  
	/**
              String yearString = "null";
              if (year != null) {
                  yearString = year.toString();
              }
              String fractionalSecondString = "null";
              if (fractionalSecond != null) {
                  fractionalSecondString = fractionalSecond.toString();
              }
           
              throw new IllegalArgumentException(
                  "year = " + yearString
                  + ", month = " + month
                  + ", day = " + day
                  + ", hour = " + hour
                  + ", minute = " + minute
                  + ", second = " + second
                  + ", fractionalSecond = " + fractionalSecondString
                  + ", timezone = " + timezone
                  + ", is not a valid representation of an XML Gregorian Calendar value."
              );
              */
          
}
      
      save();

  }
 
開發者ID:MirrorIP,項目名稱:msf-spaces-sdk-android,代碼行數:73,代碼來源:XMLGregorianCalendarImpl.java


注:本文中的org.apache.xerces.util.DatatypeMessageFormatter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。