/** * Get a suitable debug string. * * @return debug string */ public String toString() { return getName(); }
/** * Get a suitable debug string. * * @return debug string */ public String toString() { return getName(); }
public final String getName() { return iType.getName(); }
public String getName() { return iType.getName(); }
public String getName() { return iType.getName(); }
public String getName() { return iType.getName(); }
public final String getName() { return iType.getName(); }
public String getName() { return iType.getName(); }
/** * Constructor. * * @param fieldType type of field being set * @param value illegal value being set */ public IllegalFieldValueException(DurationFieldType fieldType, String value) { super(createMessage(fieldType.getName(), value)); iDateTimeFieldType = null; iDurationFieldType = fieldType; iFieldName = fieldType.getName(); iStringValue = value; iNumberValue = null; iLowerBound = null; iUpperBound = null; iMessage = super.getMessage(); }
/** * Constructor. * * @param fieldType type of field being set * @param value illegal value being set */ public IllegalFieldValueException(DurationFieldType fieldType, String value) { super(createMessage(fieldType.getName(), value)); iDateTimeFieldType = null; iDurationFieldType = fieldType; iFieldName = fieldType.getName(); iStringValue = value; iNumberValue = null; iLowerBound = null; iUpperBound = null; iMessage = super.getMessage(); }
/** * Constructor. * * @param fieldType type of field being set * @param value illegal value being set * @param lowerBound lower legal field value, or null if not applicable * @param upperBound upper legal field value, or null if not applicable */ public IllegalFieldValueException(DurationFieldType fieldType, Number value, Number lowerBound, Number upperBound) { super(createMessage(fieldType.getName(), value, lowerBound, upperBound, null)); iDateTimeFieldType = null; iDurationFieldType = fieldType; iFieldName = fieldType.getName(); iNumberValue = value; iStringValue = null; iLowerBound = lowerBound; iUpperBound = upperBound; iMessage = super.getMessage(); }
/** * Constructor. * * @param fieldType type of field being set * @param value illegal value being set * @param lowerBound lower legal field value, or null if not applicable * @param upperBound upper legal field value, or null if not applicable */ public IllegalFieldValueException(DurationFieldType fieldType, Number value, Number lowerBound, Number upperBound) { super(createMessage(fieldType.getName(), value, lowerBound, upperBound, null)); iDateTimeFieldType = null; iDurationFieldType = fieldType; iFieldName = fieldType.getName(); iNumberValue = value; iStringValue = null; iLowerBound = lowerBound; iUpperBound = upperBound; iMessage = super.getMessage(); }
/** * Checks whether a field type is supported, and if so adds the new value * to the relevant index in the specified array. * * @param type the field type * @param values the array to update * @param newValue the new value to store if successful */ private void checkAndUpdate(DurationFieldType type, int[] values, int newValue) { int index = indexOf(type); if (index == -1) { if (newValue != 0) { throw new IllegalArgumentException( "Period does not support field '" + type.getName() + "'"); } } else { values[index] = newValue; } }
/** * Checks whether a field type is supported, and if so adds the new value * to the relevant index in the specified array. * * @param type the field type * @param values the array to update * @param newValue the new value to store if successful */ private void checkAndUpdate(DurationFieldType type, int[] values, int newValue) { int index = indexOf(type); if (index == -1) { if (newValue != 0) { throw new IllegalArgumentException( "Period does not support field '" + type.getName() + "'"); } } else { values[index] = newValue; } }
/** * Adds the fields from another period. * * @param values the array of values to update * @param period the period to add from, not null * @return the updated values * @throws IllegalArgumentException if an unsupported field's value is non-zero */ protected int[] addPeriodInto(int[] values, ReadablePeriod period) { for (int i = 0, isize = period.size(); i < isize; i++) { DurationFieldType type = period.getFieldType(i); int value = period.getValue(i); if (value != 0) { int index = indexOf(type); if (index == -1) { throw new IllegalArgumentException( "Period does not support field '" + type.getName() + "'"); } else { values[index] = FieldUtils.safeAdd(getValue(index), value); } } } return values; }
/** * Adds the fields from another period. * * @param values the array of values to update * @param period the period to add from, not null * @return the updated values * @throws IllegalArgumentException if an unsupported field's value is non-zero */ protected int[] addPeriodInto(int[] values, ReadablePeriod period) { for (int i = 0, isize = period.size(); i < isize; i++) { DurationFieldType type = period.getFieldType(i); int value = period.getValue(i); if (value != 0) { int index = indexOf(type); if (index == -1) { throw new IllegalArgumentException( "Period does not support field '" + type.getName() + "'"); } else { values[index] = FieldUtils.safeAdd(getValue(index), value); } } } return values; }
/** * Get a suitable debug string. * * @return debug string */ public String toString() { return getName(); }
public String getName() { return iType.getName(); }
public final String getName() { return iType.getName(); }
public String getName() { return iType.getName(); }