Package org.apache.avro
Class Resolver.EnumAdjust
java.lang.Object
org.apache.avro.Resolver.Action
org.apache.avro.Resolver.EnumAdjust
- Enclosing class:
Resolver
Contains information needed to resolve enumerations. When resolving enums,
adjustments need to be made in two scenarios: the index for an enum symbol
might be different in the reader or writer, or the reader might not have a
symbol that was written out for the writer (which is an error, but one we can
only detect when decoding data).
These adjustments are reflected in the instance variable
adjustments. For the symbol with index i in the writer's
enum definition, adjustments[i] -- and integer -- contains the
adjustment for that symbol. If the integer is positive, then reader also has
the symbol and the integer is its index in the reader's schema. If
adjustment[i] is negative, then the reader does not have
the corresponding symbol (which is the error case).
Sometimes there's no adjustments needed: all symbols in the reader have the
same index in the reader's and writer's schema. This is a common case, and it
allows for some optimization. To signal that this is the case,
noAdjustmentsNeeded is set to true.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.avro.Resolver.Action
Resolver.Action.Type
-
Field Summary
Fields inherited from class org.apache.avro.Resolver.Action
conversion, logicalType, reader, type, writer
-
Method Summary
Modifier and TypeMethodDescriptionstatic Resolver.Action
resolve
(Schema w, Schema r, GenericData d) If writer and reader don't have same name, aResolver.ErrorAction.ErrorType.NAMES_DONT_MATCH
is returned, otherwise an appropriateResolver.EnumAdjust
is.
-
Field Details
-
adjustments
public final int[] adjustments -
values
-
noAdjustmentsNeeded
public final boolean noAdjustmentsNeeded
-
-
Method Details
-
resolve
If writer and reader don't have same name, aResolver.ErrorAction.ErrorType.NAMES_DONT_MATCH
is returned, otherwise an appropriateResolver.EnumAdjust
is.
-