Class Adapter.Primitive<T,U,TA>

java.lang.Object
org.postgresql.pljava.Adapter<T,U>
org.postgresql.pljava.Adapter.Primitive<T,U,TA>
All Implemented Interfaces:
Adapter.ArrayProto<TA>, SlotTester.Visible
Direct Known Subclasses:
Adapter.AsBoolean, Adapter.AsByte, Adapter.AsChar, Adapter.AsDouble, Adapter.AsFloat, Adapter.AsInt, Adapter.AsLong, Adapter.AsShort
Enclosing class:
Adapter<T,U>

public abstract static class Adapter.Primitive<T,U,TA> extends Adapter<T,U> implements Adapter.ArrayProto<TA>
Ancestor class for adapters that fetch something and return it as a Java primitive type.

Subclasses for integral types, namely AsLong, asInt, and AsShort, cannot be extended directly, but only via their Signed or Unsigned nested subclasses, according to how the value is meant to be used. Nothing can change how Java treats the primitive types (always as signed), but the Signed and Unsigned subclasses here offer methods for the operations that differ, allowing the right behavior to be achieved if those methods are used.

Whether an adapter extends AsShort.Unsigned or AsChar (also an unsigned 16-bit type) should be determined based on whether the resulting value is meant to have a UTF-16 character meaning.

  • Method Details

    • canFetchNull

      public boolean canFetchNull()
      Implementation of canFetchNull that unconditionally returns false, as primitive adapters have no reliably distinguishable values to which SQL null can be mapped.
      Specified by:
      canFetchNull in class Adapter<T,U>