Module org.firebirdsql.jaybird
Package org.firebirdsql.gds.ng.tz

# Class TimeZoneDatatypeCoder

java.lang.Object
org.firebirdsql.gds.ng.tz.TimeZoneDatatypeCoder

public class TimeZoneDatatypeCoder extends Object
Datatype coder for `TIME WITH TIME ZONE` and `TIMESTAMP WITH TIME ZONE`.

As this uses Java 8 and higher types, this is not part of datatype coder itself.

Since:
  4.0
Author:
  Mark Rotteveel

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static interface`
`TimeZoneDatatypeCoder.TimeZoneCodec`
Simpler API for encoding or decoding `java.time` types.

## Constructor Summary

Constructors
Constructor
Description
`TimeZoneDatatypeCoder(DatatypeCoder datatypeCoder)`
Initializes a time zone datatype coder.

## Method Summary

Modifier and Type
Method
Description
`static TimeZoneDatatypeCoder`
`getInstanceFor(DatatypeCoder datatypeCoder)`
Gets or creates an instance of time zone datatype coder for a datatype coder.
`TimeZoneDatatypeCoder.TimeZoneCodec`
`getTimeZoneCodecFor(int fieldType)`
Obtains the `TimeZoneDatatypeCoder.TimeZoneCodec` implementation for the field with the specified Firebird type.
`TimeZoneDatatypeCoder.TimeZoneCodec`
`getTimeZoneCodecFor(FieldDescriptor fieldDescriptor)`
Obtains the `TimeZoneDatatypeCoder.TimeZoneCodec` implementation for the field described by `fieldDescriptor`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### TimeZoneDatatypeCoder

public TimeZoneDatatypeCoder(DatatypeCoder datatypeCoder)
Initializes a time zone datatype coder.

Parameters:
  `datatypeCoder` - datatype coder

## Method Details

### getTimeZoneCodecFor

public TimeZoneDatatypeCoder.TimeZoneCodec getTimeZoneCodecFor(FieldDescriptor fieldDescriptor) throws SQLException
Obtains the `TimeZoneDatatypeCoder.TimeZoneCodec` implementation for the field described by `fieldDescriptor`.

Parameters:
  `fieldDescriptor` - Field descriptor
Returns:
  Suitable instance of `TimeZoneCodec`
Throws:
  `SQLException` - When `fieldDescriptor` is not a TIME/TIMESTAMP WITH TIME ZONE type field
See Also:
  - `getTimeZoneCodecFor(int)`

### getTimeZoneCodecFor

public TimeZoneDatatypeCoder.TimeZoneCodec getTimeZoneCodecFor(int fieldType) throws SQLException
Obtains the `TimeZoneDatatypeCoder.TimeZoneCodec` implementation for the field with the specified Firebird type.

Parameters:
  `fieldType` - Firebird type of the field
Returns:
  Suitable instance of `TimeZoneCodec`
Throws:
  `SQLException` - When `fieldType` is not a TIME/TIMESTAMP WITH TIME ZONE type

### getInstanceFor

public static TimeZoneDatatypeCoder getInstanceFor(DatatypeCoder datatypeCoder)
Gets or creates an instance of time zone datatype coder for a datatype coder.

Parameters:
  `datatypeCoder` - Datatype coder instance
Returns:
  Cached or new instance of `TimeZoneDatatypeCoder`