当前位置: 首页>>代码示例>>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;未经允许,请勿转载。