2017-11-25

Tamaya JodaTime (Extension Module)

Tamaya JodaTime is an extension module. Refer to the extensions documentation for further details.

What functionality this module provides ?

Tamaya JodaTime is an extension module to support the usage of Joda-Time in conjunction with Tamaya. Tamaya JodaTime defines some additional property converters to use Joda-Time types when accessing configuration.

Installation

To support Joda-Time types as configuration values, you only have to add the following maven dependency to your project:

<dependency>
  <grooupId>org.apache.tamaya.ext</groupId>
  <artifactId>tamaya-jodatime</artifactId>
  <version>{tamaya_version}</version>
</dependency>

Usage

After adding this module to your project you can retrieve Joda-Time based values directly from a given configuration.

Configuration configuration = ConfigurationProvider.getConfiguration();

DateTime pit = configuration.get("pointInTime", DateTime.class)

Currently the following types are supported:

Joda-Time target type Supported Input Formats

org.joda.time.DateTime org.joda.time.Instant

yyyy-MM-dd’T’HH:mm:ss.SSSZ

yyyy-MM-dd’T’HH:mm:ss.SSSz

yyyy-MM-dd’T’HH:mm:ss.SSS z

yyyy-MM-dd’T’HH:mm:ssZ

yyyy-MM-dd’T’HH:mm:ssz

yyyy-MM-dd’T’HH:mm:ss z

yyyy-MM-dd’T’HH:mmZ

yyyy-MM-dd’T’HH:mmz

yyyy-MM-dd’T’HH:mm z

yyyy-MM-dd’T’HHZ

yyyy-MM-dd’T’HHz

yyyy-MM-dd’T’HH z

org.joda.time.DateTimeZone

[+-]hh:mm (reg.ex.)

all timezone ids known by Joda-Time.

org.joda.time.Duration

PTa.bS

PdDThHmMsS

ddThh:mm:ss

org.joda.time.Period

PyYmMwWdDThHmMsS

Pyyyy-mm-ddThh:mm:ss

org.joda.time.LocalDate

yyyy ['-' MM ['-' dd]]

yyyy ['-' DDD]

LocalDateConverter

yyyy ['-' dd ['-' MM]]

org.joda.time.LocalTime

['T'] time-element

time-element = HH [minute-element] or [fraction]

minute-element = ':' mm [second-element] or [fraction]

second-element = ':' ss [fraction]