Overview | Package | Class | Tree | Deprecated | Index | Help
| SMILA API documentation
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.smila.datamodel
Class ValueFormatHelper

    java.lang.Object
      org.eclipse.smila.datamodel.ValueFormatHelper

    public class ValueFormatHelper

extends java.lang.Object

helper class for formatting and parsing Values. all methods synchronize on the used local formatter object, so you can use the shared instance. Using multiple instances may improve performance, though, because of less synchronization.

Author:
  jschumacher

Field Summary
`static ValueFormatHelper` | `INSTANCE` shared global helper instance.

Constructor Summary
`ValueFormatHelper()` create local instance.

Method Summary
`java.lang.String` | `formatDate(java.util.Date value)` format value as Date string.
`java.lang.String` | `formatDateTime(java.util.Date value)` format value as DateTime string.
`static java.text.SimpleDateFormat` | `getDefaultDateTimeFormat()`
`java.util.Date` | `parseDate(java.lang.String dateString)` parse a date string.
`java.util.Date` | `parseDateTime(java.lang.String dateTimeString)` parse datetime string.
`java.util.Date` | `tryParseDate(java.lang.String dateString)` parse a date string.
`java.util.Date` | `tryParseDateTime(java.lang.String dateTimeString)` parse datetime string.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### INSTANCE

    public static final ValueFormatHelper INSTANCE

  shared global helper instance.

Constructor Detail

### ValueFormatHelper

    public ValueFormatHelper()

  create local instance.

Method Detail

### getDefaultDateTimeFormat

    public static java.text.SimpleDateFormat getDefaultDateTimeFormat()

  Returns:
    the default format for datetime values.

### formatDate

    public java.lang.String formatDate(java.util.Date value)

  format value as Date string.

  Parameters:
    `value` - a date value
  Returns:
    formatted date.

### formatDateTime

    public java.lang.String formatDateTime(java.util.Date value)

  format value as DateTime string.

  Parameters:
    `value` - a datetime value
  Returns:
    formatted datetime string

### parseDate

    public java.util.Date parseDate(java.lang.String dateString)
                             throws java.text.ParseException

  parse a date string.

  Parameters:
    `dateString` - a date string
  Returns:
    parsed Date
  Throws:
    `java.text.ParseException` - string has wrong format

### tryParseDate

    public java.util.Date tryParseDate(java.lang.String dateString)

  parse a date string.

  Parameters:
    `dateString` - a date string
  Returns:
    parsed Date if correct format, else null.

### parseDateTime

    public java.util.Date parseDateTime(java.lang.String dateTimeString)
                                 throws java.text.ParseException

  parse datetime string.

  Parameters:
    `dateTimeString` - a datetime string
  Returns:
    parsed Date
  Throws:
    `java.text.ParseException` - string has wrong format

### tryParseDateTime

    public java.util.Date tryParseDateTime(java.lang.String dateTimeString)

  parse datetime string.

  Parameters:
    `dateTimeString` - a datetime string
  Returns:
    parsed Date if correct format, else null;

Overview | Package | Class | Tree | Deprecated | Index | Help
| SMILA API documentation
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD