本文整理汇总了Java中org.apache.xerces.util.DatatypeMessageFormatter.formatMessage方法的典型用法代码示例。如果您正苦于以下问题:Java DatatypeMessageFormatter.formatMessage方法的具体用法?Java DatatypeMessageFormatter.formatMessage怎么用?Java DatatypeMessageFormatter.formatMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.xerces.util.DatatypeMessageFormatter
的用法示例。
在下文中一共展示了DatatypeMessageFormatter.formatMessage方法的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]})
);
}
}
示例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;
}
示例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);
}
示例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()})
);
}
}
示例5: 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(BigDecimal n, DatatypeConstants.Field f) {
if (n != null && n.signum() < 0) {
throw new IllegalArgumentException(
DatatypeMessageFormatter.formatMessage(null, "NegativeField", new Object[]{f.toString()})
);
}
}
示例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;
}
示例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();
}