Class WritableTypeId
java.lang.Object
edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.core.type.WritableTypeId
This is a simple value class used between core streaming and higher level
databinding to pass information about type ids to write.
Properties are exposed and mutable on purpose: they are only used for communication
over serialization of a single value, and neither retained across calls nor shared
between threads.
Usual usage pattern is such that instance of this class is passed on two calls that are needed for outputting type id (and possible additional wrapping, depending on format; JSON, for example, requires wrapping as type id is part of regular data): first, a "prefix" write (which usually includes actual id), performed before value write; and then matching "suffix" write after value serialization.
- Since:
- 2.9
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Enumeration of values that matches enum `As` from annotation `JsonTypeInfo`: separate definition to avoid dependency between streaming core and annotations packages; also allows more flexibility in case new values needed at this level of internal API. -
Field Summary
Modifier and TypeFieldDescriptionIf type id is to be embedded as a regular property, name of the property; otherwise `null`.Optional additional information that generator may add during "prefix write", to be available on matching "suffix write".Java object for which type id is being written.Class<?>
(optional) Super-type offorValue
to use for type id generation (if no explicit id passed): used instead of actual class offorValue
in cases where we do not want to use the "real" type but something more generic, usually to work around specific problem with implementation type, or its deserializer.Actual type id to use: usually {link java.lang.String}.Property used to indicate style of inclusion for this type id, in cases where no native type id may be used (either because format has none, like JSON; or because use of native type ids is disabled [with YAML]).Information about intended shape of the value being written (that is,forValue
); in case of structured values, start token of the structure; for scalars, value token.boolean
Flag that can be set to indicate that wrapper structure was written (during prefix-writing); used to determine if suffix requires matching close markers. -
Constructor Summary
ConstructorDescriptionWritableTypeId
(Object value, JsonToken valueShape) Constructor used when calling a method for generating and writing Type Id; caller only knows value object and its intended shape.WritableTypeId
(Object value, JsonToken valueShape, Object id) Constructor used when calling a method for writing Type Id; caller knows value object, its intended shape as well as id to use; but not details of wrapping (if any).WritableTypeId
(Object value, Class<?> valueType, JsonToken valueShape) Constructor used when calling a method for generating and writing Type Id, but where actual type to use for generating id is NOT the type of value (but its supertype). -
Method Summary
-
Field Details
-
forValue
Java object for which type id is being written. Not needed by default handling, but may be useful for customized format handling. -
forValueType
(optional) Super-type offorValue
to use for type id generation (if no explicit id passed): used instead of actual class offorValue
in cases where we do not want to use the "real" type but something more generic, usually to work around specific problem with implementation type, or its deserializer. -
id
Actual type id to use: usually {link java.lang.String}. -
asProperty
If type id is to be embedded as a regular property, name of the property; otherwise `null`.NOTE: if "wrap-as-Object" is used, this does NOT contain property name to use but `null`.
-
include
Property used to indicate style of inclusion for this type id, in cases where no native type id may be used (either because format has none, like JSON; or because use of native type ids is disabled [with YAML]). -
valueShape
Information about intended shape of the value being written (that is,forValue
); in case of structured values, start token of the structure; for scalars, value token. Main difference is between structured values (JsonToken.START_ARRAY
,JsonToken.START_OBJECT
) and scalars (JsonToken.VALUE_STRING
): specific scalar type may not be important for processing. -
wrapperWritten
public boolean wrapperWrittenFlag that can be set to indicate that wrapper structure was written (during prefix-writing); used to determine if suffix requires matching close markers. -
extra
Optional additional information that generator may add during "prefix write", to be available on matching "suffix write".
-
-
Constructor Details
-
WritableTypeId
public WritableTypeId() -
WritableTypeId
Constructor used when calling a method for generating and writing Type Id; caller only knows value object and its intended shape.- Parameters:
value
- Actual value for which type information is writtenvalueShape
- Serialize shape writer will use for value
-
WritableTypeId
Constructor used when calling a method for generating and writing Type Id, but where actual type to use for generating id is NOT the type of value (but its supertype).- Parameters:
value
- Actual value for which type information is writtenvalueType
- Effective type ofvalue
to use for Type Id generationvalueShape
- Serialize shape writer will use for value
-
WritableTypeId
Constructor used when calling a method for writing Type Id; caller knows value object, its intended shape as well as id to use; but not details of wrapping (if any).- Parameters:
value
- Actual value for which type information is writtenvalueShape
- Serialize shape writer will use for valueid
- Actual type id to use if known;null
if not
-