org.joda.time
Class IllegalFieldValueException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by java.lang.IllegalArgumentException
                  extended by org.joda.time.IllegalFieldValueException
All Implemented Interfaces:
Serializable

public class IllegalFieldValueException
extends IllegalArgumentException

Exception thrown when attempting to set a field outside its supported range.

Since:
1.1
See Also:
Serialized Form

Constructor Summary
IllegalFieldValueException(DateTimeFieldType fieldType, Number value, Number lowerBound, Number upperBound)
          Constructor.
IllegalFieldValueException(DateTimeFieldType fieldType, Number value, String explain)
          Constructor.
IllegalFieldValueException(DateTimeFieldType fieldType, String value)
          Constructor.
IllegalFieldValueException(DurationFieldType fieldType, Number value, Number lowerBound, Number upperBound)
          Constructor.
IllegalFieldValueException(DurationFieldType fieldType, String value)
          Constructor.
IllegalFieldValueException(String fieldName, Number value, Number lowerBound, Number upperBound)
          Constructor.
IllegalFieldValueException(String fieldName, String value)
          Constructor.
 
Method Summary
 DateTimeFieldType getDateTimeFieldType()
          Returns the DateTimeFieldType whose value was invalid, or null if not applicable.
 DurationFieldType getDurationFieldType()
          Returns the DurationFieldType whose value was invalid, or null if not applicable.
 String getFieldName()
          Returns the name of the field whose value was invalid.
 Number getIllegalNumberValue()
          Returns the illegal integer value assigned to the field, or null if not applicable.
 String getIllegalStringValue()
          Returns the illegal string value assigned to the field, or null if not applicable.
 String getIllegalValueAsString()
          Returns the illegal value assigned to the field as a non-null string.
 Number getLowerBound()
          Returns the lower bound of the legal value range, or null if not applicable.
 String getMessage()
           
 Number getUpperBound()
          Returns the upper bound of the legal value range, or null if not applicable.
 void prependMessage(String message)
          Provide additional detail by prepending a message to the existing message.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IllegalFieldValueException

public IllegalFieldValueException(DateTimeFieldType fieldType,
                                  Number value,
                                  Number lowerBound,
                                  Number upperBound)
Constructor.

Parameters:
fieldType - type of field being set
value - illegal value being set
lowerBound - lower legal field value, or null if not applicable
upperBound - upper legal field value, or null if not applicable

IllegalFieldValueException

public IllegalFieldValueException(DateTimeFieldType fieldType,
                                  Number value,
                                  String explain)
Constructor.

Parameters:
fieldType - type of field being set
value - illegal value being set
explain - an explanation
Since:
1.5

IllegalFieldValueException

public IllegalFieldValueException(DurationFieldType fieldType,
                                  Number value,
                                  Number lowerBound,
                                  Number upperBound)
Constructor.

Parameters:
fieldType - type of field being set
value - illegal value being set
lowerBound - lower legal field value, or null if not applicable
upperBound - upper legal field value, or null if not applicable

IllegalFieldValueException

public IllegalFieldValueException(String fieldName,
                                  Number value,
                                  Number lowerBound,
                                  Number upperBound)
Constructor.

Parameters:
fieldName - name of field being set
value - illegal value being set
lowerBound - lower legal field value, or null if not applicable
upperBound - upper legal field value, or null if not applicable

IllegalFieldValueException

public IllegalFieldValueException(DateTimeFieldType fieldType,
                                  String value)
Constructor.

Parameters:
fieldType - type of field being set
value - illegal value being set

IllegalFieldValueException

public IllegalFieldValueException(DurationFieldType fieldType,
                                  String value)
Constructor.

Parameters:
fieldType - type of field being set
value - illegal value being set

IllegalFieldValueException

public IllegalFieldValueException(String fieldName,
                                  String value)
Constructor.

Parameters:
fieldName - name of field being set
value - illegal value being set
Method Detail

getDateTimeFieldType

public DateTimeFieldType getDateTimeFieldType()
Returns the DateTimeFieldType whose value was invalid, or null if not applicable.

Returns:
the datetime field type

getDurationFieldType

public DurationFieldType getDurationFieldType()
Returns the DurationFieldType whose value was invalid, or null if not applicable.

Returns:
the duration field type

getFieldName

public String getFieldName()
Returns the name of the field whose value was invalid.

Returns:
the field name

getIllegalNumberValue

public Number getIllegalNumberValue()
Returns the illegal integer value assigned to the field, or null if not applicable.

Returns:
the value

getIllegalStringValue

public String getIllegalStringValue()
Returns the illegal string value assigned to the field, or null if not applicable.

Returns:
the value

getIllegalValueAsString

public String getIllegalValueAsString()
Returns the illegal value assigned to the field as a non-null string.

Returns:
the value

getLowerBound

public Number getLowerBound()
Returns the lower bound of the legal value range, or null if not applicable.

Returns:
the lower bound

getUpperBound

public Number getUpperBound()
Returns the upper bound of the legal value range, or null if not applicable.

Returns:
the upper bound

getMessage

public String getMessage()
Overrides:
getMessage in class Throwable

prependMessage

public void prependMessage(String message)
Provide additional detail by prepending a message to the existing message. A colon is separator is automatically inserted between the messages.

Since:
1.3


Copyright © 2002–2016 Joda.org. All rights reserved.