- All Implemented Interfaces:
Adapter.ArrayProto<T[]>
,SlotTester.Visible
- Direct Known Subclasses:
Adapter.Array
The type variable U for the thing consumed gets no enforcement from
the compiler, because any extending adapter class provides its own
T fetch(Attribute,something)
method, with no abstract version
inherited from this class to constrain it. The method will be found
reflectively by name and parameter types, so the "something" only has to
match the type of the accessor method specified with Via
, or the
type returned by an underlying adapter that this one will be composed
over.
In particular, that means this is the class to extend even if using a
primitive accessor method, or composing over an adapter that returns a
primitive type, as long as this adapter will return a reference type T.
Such an adapter simply declares that it extends As<T,Void>
when
based on a primitive accessor method, or As<T,boxed-class>
when
composed over another adapter of primitive type, where boxed-class is the
boxed counterpart of the other adapter's primitive type.
When Java's reflection methods on generic types are used to compute the (non-erased) result type of a stack of composed adapters, the type variable U can be used in relating the input to the output type of each.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.postgresql.pljava.Adapter
Adapter.AdapterException, Adapter.Array<T>, Adapter.ArrayBuilder<TA,
TI>, Adapter.ArrayProto<TA>, Adapter.As<T, U>, Adapter.AsBoolean<U>, Adapter.AsByte<U>, Adapter.AsChar<U>, Adapter.AsDouble<U>, Adapter.AsFloat<U>, Adapter.AsInt<U>, Adapter.AsLong<U>, Adapter.AsShort<U>, Adapter.Configuration, Adapter.Container, Adapter.Contract<T>, Adapter.Dispenser<T, U extends Adapter.Contract<T>>, Adapter.Permission, Adapter.Primitive<T, U, TA>, Adapter.PullDispenser<T, U extends Adapter.Contract<T>>, Adapter.Service, Adapter.Via -
Constructor Summary
ModifierConstructorDescriptionprotected
Constructor for a simple leafAdapter
, or a composing (non-leaf)Adapter
when passed another adapter over which it should be composed.protected
As
(Adapter.Contract.Scalar<T> using, Class<T> witness, Adapter.Configuration c) Constructor for a leafAdapter
that is based on aContract
. -
Method Summary
Modifier and TypeMethodDescriptionT[]
arrayOf
(int length) Allocate an array of the given length with this adapter's result type as its component type.boolean
A default implementation ofcanFetchNull
that unconditionally returns true.final <B> T
fetch
(Datum.Accessor<B, ?> acc, B buffer, int offset, Attribute a) Method invoked internally when thisAdapter
is used to fetch a value; not intended for use in application code.Determines the value to which SQL null should be mapped.Methods inherited from class org.postgresql.pljava.Adapter
canFetch, canFetch, configure, topType, topType, toString, underType
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.postgresql.pljava.Adapter.ArrayProto
a1, a2, a4
-
Constructor Details
-
As
Constructor for a simple leafAdapter
, or a composing (non-leaf)Adapter
when passed another adapter over which it should be composed.- Parameters:
c
- Configuration instance generated for this classover
- null for a leaf Adapter, otherwise another Adapter to compose this one overwitness
- if not null, the top type the resulting adapter will produce, if a Class object can specify that more precisely than the default typing rules.
-
As
Constructor for a leafAdapter
that is based on aContract
.- Parameters:
using
- the scalar Contract that will be used to produce the value returnedwitness
- if not null, the top type the resulting adapter will produce, if a Class object can specify that more precisely than the default typing rules.c
- Configuration instance generated for this class
-
-
Method Details
-
fetch
Method invoked internally when thisAdapter
is used to fetch a value; not intended for use in application code. -
canFetchNull
public boolean canFetchNull()A default implementation ofcanFetchNull
that unconditionally returns true.An adapter that extends this class, if it does not override
fetchNull
, will simply map any SQL null value to a Java null.- Specified by:
canFetchNull
in classAdapter<T,
U>
-
fetchNull
Determines the value to which SQL null should be mapped.If not overridden, this implementation returns Java null.
-
arrayOf
Allocate an array of the given length with this adapter's result type as its component type.
-