public interface DeprecationHandler
Callback for notifying the creator of the
XContentParser
that
parsing hit a deprecated field.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DeprecationHandler
Ignores all deprecationsstatic final DeprecationHandler
Throws anUnsupportedOperationException
when parsing hits a deprecated field. -
Method Summary
Modifier and TypeMethodDescriptionvoid
logRemovedField
(String parserName, Supplier<XContentLocation> location, String removedName) Called when the provided field name matches the current field but the entire field has been marked as deprecated with no replacement Emits a compatible api warning instead of deprecation warning when isCompatibleDeprecation is truedefault void
logRemovedField
(String parserName, Supplier<XContentLocation> location, String removedName, boolean isCompatibleDeprecation) void
logRenamedField
(String parserName, Supplier<XContentLocation> location, String oldName, String currentName) Called when the provided field name matches a deprecated name for the field.default void
logRenamedField
(String parserName, Supplier<XContentLocation> location, String oldName, String currentName, boolean isCompatibleDeprecation) void
logReplacedField
(String parserName, Supplier<XContentLocation> location, String oldName, String replacedName) Called when the provided field name matches the current field but the entire field has been marked as deprecated and another field should be useddefault void
logReplacedField
(String parserName, Supplier<XContentLocation> location, String oldName, String replacedName, boolean isCompatibleDeprecation)
-
Field Details
-
THROW_UNSUPPORTED_OPERATION
Throws anUnsupportedOperationException
when parsing hits a deprecated field. Use this when creating anXContentParser
that won't interact with deprecation logic at all or when you want to fail fast when parsing deprecated fields. -
IGNORE_DEPRECATIONS
Ignores all deprecations
-
-
Method Details
-
logRenamedField
void logRenamedField(String parserName, Supplier<XContentLocation> location, String oldName, String currentName) Called when the provided field name matches a deprecated name for the field.- Parameters:
oldName
- the provided field namecurrentName
- the modern name for the field
-
logReplacedField
void logReplacedField(String parserName, Supplier<XContentLocation> location, String oldName, String replacedName) Called when the provided field name matches the current field but the entire field has been marked as deprecated and another field should be used- Parameters:
oldName
- the provided field namereplacedName
- the name of the field that replaced this field
-
logRemovedField
Called when the provided field name matches the current field but the entire field has been marked as deprecated with no replacement Emits a compatible api warning instead of deprecation warning when isCompatibleDeprecation is true- Parameters:
removedName
- the provided field name
-
logRenamedField
default void logRenamedField(String parserName, Supplier<XContentLocation> location, String oldName, String currentName, boolean isCompatibleDeprecation) - See Also:
-
logReplacedField
default void logReplacedField(String parserName, Supplier<XContentLocation> location, String oldName, String replacedName, boolean isCompatibleDeprecation) - See Also:
-
logRemovedField
default void logRemovedField(String parserName, Supplier<XContentLocation> location, String removedName, boolean isCompatibleDeprecation) - See Also:
-