CAST
.
May annotate a Java method (which should also carry a
@Function
annotation, making it a PostgreSQL function),
or a class or interface (just to have a place to put it when not directly
associated with a method).
If not applied to a method, must supply path=
specifying
BINARY
or INOUT
.
The source and target types must be specified with from
and
to
, unless the annotation appears on a method, in which case these
default to the first parameter and return types of the function,
respectively.
The cast will, by default, have to be applied explicitly, unless
application=ASSIGNMENT
or application=IMPLICIT
is given.
- Author:
- Chapman Flack
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
When this cast can be applied: only in explicit form, when used in assignment context, or implicitly whenever needed.static enum
A known conversion path when a dedicated function is not supplied:BINARY
for two types that are known to have the same internal representation, orINOUT
to invoke the first type's text-output function followed by the second type's text-input function. -
Optional Element Summary
Modifier and TypeOptional ElementDescriptionWhen this cast can be applied: only in explicit form, when used in assignment context, or implicitly whenever needed.A comment to be associated with the cast.The source type to be cast.The<implementor name>
to be used around SQL code generated for this cast.A stock conversion path when a dedicated function is not supplied:BINARY
for two types that are known to have the same internal representation, orINOUT
to invoke the first type's text-output function followed by the second type's text-input function.String[]
One or more arbitrary labels that will be considered 'provided' by the object carrying this annotation.String[]
One or more arbitrary labels that will be considered 'required' by the object carrying this annotation.The target type to cast to.
-
Element Details
-
from
String fromThe source type to be cast. Will default to the first parameter type of the associated function, if known.PostgreSQL will allow this type and the function's first parameter type to differ, if there is an existing binary cast between them. That cannot be checked at compile time, so a cast with a different type given here might successfully compile but fail to deploy in PostgreSQL.
- Default:
""
-
to
String toThe target type to cast to. Will default to the return type of the associated function, if known.PostgreSQL will allow this type and the function's return type to differ, if there is an existing binary cast between them. That cannot be checked at compile time, so a cast with a different type given here might successfully compile but fail to deploy in PostgreSQL.
- Default:
""
-
path
Cast.Path pathA stock conversion path when a dedicated function is not supplied:BINARY
for two types that are known to have the same internal representation, orINOUT
to invoke the first type's text-output function followed by the second type's text-input function.To declare an
INOUT
cast,with=INOUT
must appear explicitly; the default value is treated as unspecified.- Default:
INOUT
-
application
Cast.Application applicationWhen this cast can be applied: only in explicit form, when used in assignment context, or implicitly whenever needed.- Default:
EXPLICIT
-
provides
String[] providesOne or more arbitrary labels that will be considered 'provided' by the object carrying this annotation. The deployment descriptor will be generated in such an order that other objects that 'require' labels 'provided' by this come later in the output for install actions, and earlier for remove actions.- Default:
{}
-
requires
String[] requiresOne or more arbitrary labels that will be considered 'required' by the object carrying this annotation. The deployment descriptor will be generated in such an order that other objects that 'provide' labels 'required' by this come earlier in the output for install actions, and later for remove actions.- Default:
{}
-
implementor
String implementorThe<implementor name>
to be used around SQL code generated for this cast. Defaults toPostgreSQL
. Set explicitly to""
to emit code not wrapped in an<implementor block>
.- Default:
""
-
comment
String commentA comment to be associated with the cast. If left to default, and the annotated Java construct has a doc comment, its first sentence will be used. If an empty string is explicitly given, no comment will be set.- Default:
""
-