com.vertica.sdk.NoopTypeCoercion Class Reference
Inheritance diagram for com.vertica.sdk.NoopTypeCoercion:
Collaboration diagram for com.vertica.sdk.NoopTypeCoercion:
| Public Member Functions | |
|---|---|
| ByteBuffer | asBinaryBytes (Object value, int length, VerticaType type) |
| Boolean | asBoolean (Object value, VerticaType type) |
| ByteBuffer | asCharBytes (Object value, int length, VerticaType type) |
| java.sql.Date | asDate (Object value, VerticaType type) |
| Double | asDouble (Object value, VerticaType type) |
| Long | asLong (Object value, VerticaType type) |
| java.sql.Timestamp | asTimestamp (Object value, VerticaType type) |
| Iterator< Object > | getListIterator (Object value) |
| Iterator< Map.Entry< String, Object > > | getMapIterator (Object value) |
| MetaType | getMetaType (Object value) |
| Set< TypeCoercionPolicy > | getPolicy () |
| void | setPolicy (Collection< TypeCoercionPolicy > policy) |
| Protected Member Functions | |
|---|---|
| Collection< TypeCoercionPolicy > | getDefaultPolicy () |
| void | invalidInputType (Object value, VerticaType type) |
| void | unsupportedType (Object value, VerticaType type) |
| void | valueTooLarge (Object value, VerticaType type) |
Detailed Description
NoopTypeCoercion implements no type conversions, but passes already-valid types to the destination. Values may be truncated if the policy includes TRUNCATE_VALUES.
The default policy favors errors and avoids modifying data. See getDefaultPolicy().
Member Function Documentation
◆asBinaryBytes()
ByteBuffer com.vertica.sdk.NoopTypeCoercion.asBinaryBytes(Object value, int length, VerticaType type)
Generates a ByteBuffer (or null) value out of a sequence of bytes. Acceptable input types are byte array and ByteBuffer. All other types are invalid and will result in null or a TypeCoercionException according to the policy.
In agreement with how 'binary' values are stored in Vertica, values smaller than the target length are right-extended to length with the zero byte.
The value will be truncated to length when necessary if TRUNCATE_VALUES is specified in the policy. Otherwise values that are too long are treated as invalid input values (see FAIL_INVALID_INPUT_VALUE).
See also
Implements com.vertica.sdk.TypeCoercion.
◆asBoolean()
Boolean com.vertica.sdk.NoopTypeCoercion.asBoolean(Object value, VerticaType type)
Generates a Boolean (or null) value out of null objects or Boolean type objects. All other types are invalid and will result in null or a TypeCoercionException according to the policy.
Implements com.vertica.sdk.TypeCoercion.
◆asCharBytes()
ByteBuffer com.vertica.sdk.NoopTypeCoercion.asCharBytes(Object value, int length, VerticaType type)
Generates a ByteBuffer (or null) value out of null objects or String type objects. All other types are invalid and will result in null or a TypeCoercionException according to the policy.
The bytes will not include trailing spaces if the type is 'char'.
The value will be truncated to length when necessary if TRUNCATE_VALUES is specified in the policy. Otherwise values that are too long are treated as invalid input values (see FAIL_INVALID_INPUT_VALUE).
See also
Implements com.vertica.sdk.TypeCoercion.
◆asDate()
java.sql.Date com.vertica.sdk.NoopTypeCoercion.asDate(Object value, VerticaType type)
Generate a java.sql.Date (or null) value out of values that are either null, java.sql.Date, or java.util.Date (which includes java.sql.Timestamp and java.sql.Time types).
Note that this is an exception to the general principle of NoopTypeCoercion: some coercion may actually take place here. This is because java.util.Date is so closely related to the java.sql.Date type and much more prevalent.
Implements com.vertica.sdk.TypeCoercion.
◆asDouble()
Double com.vertica.sdk.NoopTypeCoercion.asDouble(Object value, VerticaType type)
Generates a Double (or null) value out of null objects or Double type objects. All other types are invalid and will result in null or a TypeCoercionException according to the policy.
Implements com.vertica.sdk.TypeCoercion.
◆asLong()
Long com.vertica.sdk.NoopTypeCoercion.asLong(Object value, VerticaType type)
Generates a Long (or null) value out of null objects or Long type objects. All other types are invalid and will result in null or a TypeCoercionException according to the policy.
Implements com.vertica.sdk.TypeCoercion.
◆asTimestamp()
java.sql.Timestamp com.vertica.sdk.NoopTypeCoercion.asTimestamp(Object value, VerticaType type)
Generate a java.sql.Timestamp (or null) value out of values that are either null, java.sql.Timestamp, or java.util.Date (which includes java.sql.Date and java.sql.Time types).
Note that this is an exception to the general principle of NoopTypeCoercion; some coercion may actually take place here. This is because java.util.Date is so closely related to the java.sql.Timestamp type and much more prevalent.
Implements com.vertica.sdk.TypeCoercion.
◆getDefaultPolicy()
Collection<TypeCoercionPolicy> com.vertica.sdk.NoopTypeCoercion.getDefaultPolicy()
protected
Provides the default policy installed by the constructor.
For NoopTypeCoercion, the default policy favors errors and avoids modifying data:
-
FAIL_SDK_UNSUPPORTED_TYPE
-
FAIL_UNSUPPORTED_TYPE
-
FAIL_INVALID_INPUT_TYPE
-
FAIL_INVALID_INPUT_VALUE
◆getListIterator()
Iterator<Object> com.vertica.sdk.NoopTypeCoercion.getListIterator(Object value)
Provides an Iterator over Objects for a given Iterable input.
Parameters
value: Something implementing Iterable
Implements com.vertica.sdk.TypeCoercion.
◆getMapIterator()
Iterator<Map.Entry<String,Object> > com.vertica.sdk.NoopTypeCoercion.getMapIterator(Object value)
Provides an Iterator over map entries for a given Map.
Internal maps are assumed to have String keys. A ClassCastException will eventually result if there are internal maps with keys that are not Strings.
Parameters
value: Something implementing Map<String,Object>
Implements com.vertica.sdk.TypeCoercion.
◆getMetaType()
MetaType com.vertica.sdk.NoopTypeCoercion.getMetaType(Object value)
Detects Java standard Map and Iterable types.
Internal maps are assumed to have String keys. A ClassCastException will result if there are internal maps with keys that are not Strings.
Implements com.vertica.sdk.TypeCoercion.
◆getPolicy()
Set<TypeCoercionPolicy> com.vertica.sdk.NullTypeCoercion.getPolicy()
inherited Returns an unmodifiable version of the policy.
Returns The policy collection.
See also
Implements com.vertica.sdk.TypeCoercion.
Referenced by
- com.vertica.sdk.NoopTypeCoercion.asBinaryBytes()
- com.vertica.sdk.NoopTypeCoercion.asCharBytes()
- com.vertica.sdk.StandardTypeCoercion.asCharBytes()
- com.vertica.sdk.NoopTypeCoercion.invalidInputType()
- com.vertica.sdk.StandardTypeCoercion.invalidInputValue()
- com.vertica.sdk.NullTypeCoercion.unsupportedType()
- com.vertica.sdk.NoopTypeCoercion.valueTooLarge()
◆invalidInputType()
void com.vertica.sdk.NoopTypeCoercion.invalidInputType(Object value, VerticaType type)
protected
Throws a TypeCoercionException if the policy includes FAIL_INVALID_INPUT_TYPE. Otherwise does nothing.
Parameters
value: The value being coerced.type: The target type.
See also
getPolicy()
#setPolicy(Collection)
Referenced by
- com.vertica.sdk.NoopTypeCoercion.asBinaryBytes()
- com.vertica.sdk.NoopTypeCoercion.asBoolean()
- com.vertica.sdk.StandardTypeCoercion.asBooleanByJava()
- com.vertica.sdk.StandardTypeCoercion.asBooleanByNumeric()
- com.vertica.sdk.StandardTypeCoercion.asBooleanByVertica()
- com.vertica.sdk.NoopTypeCoercion.asCharBytes()
- com.vertica.sdk.NoopTypeCoercion.asDate()
- com.vertica.sdk.StandardTypeCoercion.asDate()
- com.vertica.sdk.NoopTypeCoercion.asDouble()
- com.vertica.sdk.StandardTypeCoercion.asDouble()
- com.vertica.sdk.NoopTypeCoercion.asLong()
- com.vertica.sdk.StandardTypeCoercion.asLong()
- com.vertica.sdk.NoopTypeCoercion.asTimestamp()
- com.vertica.sdk.StandardTypeCoercion.asTimestamp()
◆setPolicy()
void com.vertica.sdk.NullTypeCoercion.setPolicy(Collection< TypeCoercionPolicy > policy)
inherited Sets the policies for this TypeCoercion instance. Policies generally dictate which scenarios generate exceptions and allow for different error handling choices without implementing a new TypeCoercion class.
Parameters
policy: The policy collection
See also
Implements com.vertica.sdk.TypeCoercion.
Referenced by com.vertica.sdk.NullTypeCoercion.NullTypeCoercion().
◆unsupportedType()
void com.vertica.sdk.NullTypeCoercion.unsupportedType(Object value, VerticaType type)
protected inherited Throws a TypeCoercionException if the policy includes TypeCoercionPolicy#FAIL_UNSUPPORTED_TYPE. Otherwise does nothing.
Parameters
value: The value provided which could not be coerced.type: The target Vertica type.
See also
getPolicy()
#setPolicy(Collection)
Referenced by
- com.vertica.sdk.NullTypeCoercion.asBinaryBytes()
- com.vertica.sdk.NullTypeCoercion.asBoolean()
- com.vertica.sdk.NullTypeCoercion.asCharBytes()
- com.vertica.sdk.NullTypeCoercion.asDate()
- com.vertica.sdk.NullTypeCoercion.asDouble()
- com.vertica.sdk.NullTypeCoercion.asLong()
- com.vertica.sdk.NullTypeCoercion.asTimestamp()
◆valueTooLarge()
void com.vertica.sdk.NoopTypeCoercion.valueTooLarge(Object value, VerticaType type)
protected
Throws a TypeCoercionException with a TRUNCATE_VALUES cause if the policy includes FAIL_INVALID_INPUT_VALUE. Otherwise does nothing.
This should only be called if the policy does not request truncation via TRUNCATE_VALUES.
Parameters
value: The value being coerced.type: The target type.
See also
getPolicy()
#setPolicy(Collection)
Referenced by