Interface IValueObject<TYPE>
- All Known Implementing Classes:
- BigDecimalValue,- BigIntegerValue,- BinaryValue,- BooleanValue,- ByteValue,- DoubleValue,- DurationValue,- FloatValue,- IntegerValue,- KStringValue,- LocalDateTimeValue,- LocalDateValue,- LocalTimeValue,- LongValue,- MonthDayValue,- NumberValue,- OffsetDateTimeValue,- OffsetTimeValue,- PeriodValue,- ShortValue,- StringValue,- TermporalAccessorValue,- TermporalAmountValue,- XMLDurationValue,- XMLGregorianCalendarValue,- YearMonthValue,- YearValue,- ZonedDateTimeValue
Pattern is defined to be able to select formatters of different types, before passing in the rest of the pattern. If this is the case, the pattern string must begin with [type], where "type" is one of:
- "short" (for date/time)
- "medium" (for date/time)
- "long" (for date/time)
- "full" (for date/time)
- integer (for numeric values)
- currency (for numeric values)
- percent (for numeric values)
In addition, the resolver style for how a value is parsed from a String can be specified in the start of the pattern as:
- [strict],
- [smart], or
- [lenient].
- Author:
- Christopher Mindus
- Field SummaryFieldsModifier and TypeFieldDescription- static final StringThe pattern: Basic ISO date '20111203'.- static final StringThe pattern "currency" for numeric values.- static final StringThe pattern "full" for date/time.- static final StringThe pattern "integer" for numeric values.- static final StringThe pattern: ISO Date with or without offset '2011-12-03+01:00'; '2011-12-03'.- static final StringThe pattern: Date and time with ZoneId '2011-12-03T10:15:30+01:00[Europe/Paris]'.- static final StringThe pattern: Date and Time of an Instant '2011-12-03T10:15:30Z'.- static final StringThe pattern: ISO Local Date '2011-12-03'.- static final StringThe pattern: ISO Local Date and Time '2011-12-03T10:15:30'.- static final StringThe pattern: Time without offset '10:15:30'.- static final StringThe pattern: ISO Date with offset '2011-12-03+01:00'.- static final StringThe pattern: Date Time with Offset 2011-12-03T10:15:30+01:00'.- static final StringThe pattern: Time with offset '10:15:30+01:00'.- static final StringThe pattern: Year and day of year '2012-337'.- static final StringThe pattern: Time with or without offset '10:15:30+01:00'; '10:15:30'.- static final StringThe pattern: Year and Week 2012-W48-6'.- static final StringThe pattern: Zoned Date Time '2011-12-03T10:15:30+01:00[Europe/Paris]'.- static final StringThe pattern "long" for date/time.- static final StringThe pattern "medium" for date/time.- static final StringThe pattern "percent" for numeric values.- static final StringThe pattern: RFC 1123 / RFC 822 'Tue, 3 Jun 2008 11:05:30 GMT'.- static final StringThe pattern "short" for date/time.- static final StringResolver style for parsing date/time, should precede the pattern string.- static final String- static final StringResolver style for parsing date/time, should precede the pattern string.- static final String- static final StringResolver style for parsing date/time, should precede the pattern string.- static final String
- Method SummaryModifier and TypeMethodDescription- long- asLong- (TYPE value, LocaleInfo localeInfo) Returns a long value if possible.- default long- asLongCast- (Object value, LocaleInfo localeInfo) Returns a long value if possible.- convert- (Object value, Value.Type oldType, LocaleInfo localeInfo) Converts a value from another type.Creates the default value object for the data type.Gets the description of the type, used for the Designer.- getFormatter- (String pattern, LocaleInfo localeInfo) Returns the Formatter for a pattern.Gets the class of the value.Gets the value type.- default booleanChecks if this type is right-aligned in table columns.Loads the value from an Element.Creates a Value object from a String using a specified pattern and locale.- parse- (String value, String pattern, LocaleInfo localeInfo) Creates a Value object from a String using a specified pattern and locale.Saves the value to an Element.- default StringSaves the value to an Element.The default "toString" representation.- toString- (TYPE value, String pattern, LocaleInfo localeInfo) Formats the value to a String.- default String- toStringCast- (Object value, String pattern, LocaleInfo localeInfo) Formats the value to a String.- default String- toStringForced- (Object value) Calls the "toString" method with any object, casting it.
- Field Details- PATTERN_SHORTThe pattern "short" for date/time.- See Also:
 
- PATTERN_MEDIUMThe pattern "medium" for date/time.- See Also:
 
- PATTERN_LONGThe pattern "long" for date/time.- See Also:
 
- PATTERN_FULLThe pattern "full" for date/time.- See Also:
 
- PATTERN_BASIC_ISO_DATEThe pattern: Basic ISO date '20111203'.- See Also:
 
- PATTERN_ISO_LOCAL_DATEThe pattern: ISO Local Date '2011-12-03'.- See Also:
 
- PATTERN_ISO_OFFSET_DATEThe pattern: ISO Date with offset '2011-12-03+01:00'.- See Also:
 
- PATTERN_ISO_DATEThe pattern: ISO Date with or without offset '2011-12-03+01:00'; '2011-12-03'.- See Also:
 
- PATTERN_ISO_LOCAL_TIMEThe pattern: Time without offset '10:15:30'.- See Also:
 
- PATTERN_ISO_OFFSET_TIMEThe pattern: Time with offset '10:15:30+01:00'.- See Also:
 
- PATTERN_ISO_TIMEThe pattern: Time with or without offset '10:15:30+01:00'; '10:15:30'.- See Also:
 
- PATTERN_ISO_LOCAL_DATE_TIMEThe pattern: ISO Local Date and Time '2011-12-03T10:15:30'.- See Also:
 
- PATTERN_ISO_OFFSET_DATE_TIMEThe pattern: Date Time with Offset 2011-12-03T10:15:30+01:00'.- See Also:
 
- PATTERN_ISO_ZONED_DATE_TIMEThe pattern: Zoned Date Time '2011-12-03T10:15:30+01:00[Europe/Paris]'.- See Also:
 
- PATTERN_ISO_DATE_TIMEThe pattern: Date and time with ZoneId '2011-12-03T10:15:30+01:00[Europe/Paris]'.- See Also:
 
- PATTERN_ISO_ORDINAL_DATEThe pattern: Year and day of year '2012-337'.- See Also:
 
- PATTERN_ISO_WEEK_DATEThe pattern: Year and Week 2012-W48-6'.- See Also:
 
- PATTERN_ISO_INSTANTThe pattern: Date and Time of an Instant '2011-12-03T10:15:30Z'.- See Also:
 
- PATTERN_RFC_1123_DATE_TIMEThe pattern: RFC 1123 / RFC 822 'Tue, 3 Jun 2008 11:05:30 GMT'.- See Also:
 
- PATTERN_INTEGERThe pattern "integer" for numeric values.- See Also:
 
- PATTERN_PERCENTThe pattern "percent" for numeric values.- See Also:
 
- PATTERN_CURRENCYThe pattern "currency" for numeric values.- See Also:
 
- RESOLVER_STRICTResolver style for parsing date/time, should precede the pattern string.- Style to resolve dates and times strictly. - Using strict resolution will ensure that all parsed values are within the outer range of valid values for the field. Individual fields may be further processed for strictness. - For example, resolving year-month and day-of-month in the ISO calendar system using strict mode will ensure that the day-of-month is valid for the year-month, rejecting invalid values. - See Also:
 
- RESOLVER_STRICT_NO_BRACKETS- See Also:
 
- RESOLVER_SMARTResolver style for parsing date/time, should precede the pattern string.- Style to resolve dates and times in a smart, or intelligent, manner. - Using smart resolution will perform the sensible default for each field, which may be the same as strict, the same as lenient, or a third behavior. Individual fields will interpret this differently. - For example, resolving year-month and day-of-month in the ISO calendar system using smart mode will ensure that the day-of-month is from 1 to 31, converting any value beyond the last valid day-of-month to be the last valid day-of-month. - See Also:
 
- RESOLVER_SMART_NO_BRACKETS- See Also:
 
- RESOLVER_LENIENTResolver style for parsing date/time, should precede the pattern string.- Style to resolve dates and times leniently. - Using lenient resolution will resolve the values in an appropriate lenient manner. Individual fields will interpret this differently. - For example, lenient mode allows the month in the ISO calendar system to be outside the range 1 to 12. For example, month 15 is treated as being 3 months after month 12. - See Also:
 
- RESOLVER_LENIENT_NO_BRACKETS- See Also:
 
 
- Method Details- getValueTypeValue.Type getValueType()Gets the value type.
- getValueClassGets the class of the value.
- getDescriptionString getDescription()Gets the description of the type, used for the Designer.
- createDefaultTYPE createDefault()Creates the default value object for the data type.- Returns:
- The default value.
 
- isRightAligneddefault boolean isRightAligned()Checks if this type is right-aligned in table columns.- Returns:
- true for right-aligned values, default is false: left-aligned.
 
- getFormatterReturns the Formatter for a pattern.- Parameters:
- pattern- The pattern to use, null for none.
- localeInfo- The locale information instance, or null for none.
- Returns:
- The formatter to use, or null for none.
- Throws:
- IllegalArgumentException- For formatter errors.
 
- toStringThe default "toString" representation.- Parameters:
- value- The value could be null.
- Returns:
- The String representation.
 
- toStringForcedCalls the "toString" method with any object, casting it. IF casting fails, which should not be, then- String.valueOf(value)is called.- Parameters:
- value- The value could be null.
- Returns:
- The String representation.
 
- toStringString toString- (TYPE value, String pattern, LocaleInfo localeInfo) throws IllegalArgumentException, Exception Formats the value to a String.- Parameters:
- value- The value is never null.
- pattern- Pattern to use, null for none.
- localeInfo- The locale information instance, or null for none.
- Returns:
- The String representation using specified pattern and locale information.
- Throws:
- IllegalArgumentException- For formatter errors.
- Exception- For other errors.
 
- toStringCastdefault String toStringCast- (Object value, String pattern, LocaleInfo localeInfo) throws IllegalArgumentException, Exception Formats the value to a String.- Parameters:
- value- The value is never null.
- pattern- Pattern to use, null for none.
- localeInfo- The locale information instance, or null for none.
- Returns:
- The String representation using specified pattern and locale information.
- Throws:
- IllegalArgumentException- For formatter errors.
- Exception- For other errors.
 
- parseCreates a Value object from a String using a specified pattern and locale.- Parameters:
- value- The value, never null.
- Returns:
- The value object, never null.
- Throws:
- ParseException- If the value could not be parsed.
- IllegalArgumentException- For pattern errors.
- Exception- For other errors.
 
- parseTYPE parse- (String value, String pattern, LocaleInfo localeInfo) throws ParseException, IllegalArgumentException, Exception Creates a Value object from a String using a specified pattern and locale.- Parameters:
- value- The value, never null.
- pattern- The pattern, null for none.
- localeInfo- The locale info, null for default.
- Returns:
- The value object, never null.
- Throws:
- ParseException- If the value could not be parsed.
- IllegalArgumentException- For pattern errors.
- Exception- For other errors.
 
- loadLoads the value from an Element.- Parameters:
- value- The String value in the element.
- element- The element holding the information for advanced processing using JAXB.
- Throws:
- Exception- An exception due to parsing, bean unmarshalling, etc.
 
- saveSaves the value to an Element.- Parameters:
- value- The value to save.
- element- The element to save information into for advanced processing using JAXB.
- Returns:
- The String value to set in the Element, or null if advanced processing is used.
- Throws:
- Exception
 
- saveCastSaves the value to an Element.- Parameters:
- value- The value to save.
- element- The element to save information into for advanced processing using JAXB.
- Returns:
- The String value to set in the Element, or null if advanced processing is used.
- Throws:
- Exception
 
- convertConverts a value from another type. If the type is not defined, check the object instance for possible conversions.- Parameters:
- value- The value to convert.
- oldType- The old type, null for not defined or unknown.
- localeInfo- The locale information, null to look-up from current thread or if not found, for system default.
- Returns:
- The value object.
- Throws:
- Exception- For other errors.
- ParseException- If this conversion fails.
 
- asLongReturns a long value if possible.- Parameters:
- value- The Value object.
- localeInfo- The locale information, null to look-up from current thread or if not found, for system default.
- Returns:
- The long value, e.g. in milliseconds, or Long.MIN_VALUE for not possible.
 
- asLongCastReturns a long value if possible.- Parameters:
- value- The Value object.
- localeInfo- The locale information, null to look-up from current thread or if not found, for system default.
- Returns:
- The long value, e.g. in milliseconds, or Long.MIN_VALUE for not possible.