- Enclosing class:
AbstractType
Construct a MultiArray
by supplying a component Type
and
a number of dimensions. The resulting MultiArray
represents the
Java array type, and has a number of bracket pairs equal to the supplied
dimensions argument plus those of the component type if it is itself a
Java array. (There could be an Adapter
for some PostgreSQL scalar
type that presents it as a Java array, and then there could be a
PostgreSQL array of that type.) So the type reported by
arrayType
may have more bracket pairs than the
MultiArray
's dimensions. Parentheses are used by
toString
to help see what's going on.
When converting a MultiArray
to a Sized
, only as
many sizes are supplied as the multiarray's dimensions, and when
converting that to an Allocated
, only that much
allocation is done. Populating the arrays at that last allocated level
with the converted elements of the PostgreSQL array is the work left
for the caller.
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
Represents aMultiArray
for which sizes for its dimensions have been specified, so that an instance can be allocated. -
Field Summary
-
Constructor Summary
ConstructorDescriptionMultiArray
(Type component, int dimensions) Constructs a description of a multiarray with a given component type and dimensions. -
Method Summary
Modifier and TypeMethodDescriptionReturns the resulting Java array type (which, if the component type is also an array, does not distinguish between its dimensions and those of this multiarray).asPrefixOf
(AbstractType.MultiArray suffix) Returns thisMultiArray
as a 'prefix' of suffix (which must have the same ultimate non-array type but a smaller number of dimensions).Returns a newMultiArray
with the same Java array type but wherecomponent
is a non-array type anddimensions
holds the total number of dimensions.static AbstractType.MultiArray
canonicalize
(Type t) Returns aMultiArray
representing an array type t in a canonical form, with its ultimate non-array type as the component type, and all of its array dimensions belonging to the multiarray.Returns a newMultiArray
with this one's type (possibly a raw, or parameterized type) refined according to the known type of model.size
(int... dims) Returns aSized
representing thisMultiArray
with a size for each of its dimensions.toString()
Returns a representation of the resulting Java array type, with parentheses around the component type (which may itself be an array type) and around the array brackets corresponding to this multiarray's dimensions.
-
Field Details
-
component
-
dimensions
public final int dimensions
-
-
Constructor Details
-
MultiArray
Constructs a description of a multiarray with a given component type and dimensions.- Parameters:
component
- the type of the component (which may itself be an array)dimensions
- dimensions of the multiarray (if the component type is an array, the final resulting type will have the sum of its dimensions and these)
-
-
Method Details
-
toString
Returns a representation of the resulting Java array type, with parentheses around the component type (which may itself be an array type) and around the array brackets corresponding to this multiarray's dimensions. -
arrayType
Returns the resulting Java array type (which, if the component type is also an array, does not distinguish between its dimensions and those of this multiarray). -
canonicalize
Returns aMultiArray
representing an array type t in a canonical form, with its ultimate non-array type as the component type, and all of its array dimensions belonging to the multiarray. -
canonicalize
Returns a newMultiArray
with the same Java array type but wherecomponent
is a non-array type anddimensions
holds the total number of dimensions. -
asPrefixOf
Returns thisMultiArray
as a 'prefix' of suffix (which must have the same ultimate non-array type but a smaller number of dimensions).The result will have the array type of suffix as its component type, and the dimensions required to have the same overall Java
arrayType
as the receiver. -
refine
Returns a newMultiArray
with this one's type (possibly a raw, or parameterized type) refined according to the known type of model. -
size
Returns aSized
representing thisMultiArray
with a size for each of its dimensions.
-