Package org.opensearch.common.xcontent
Interface DeprecationHandler
-
public interface DeprecationHandlerCallback for notifying the creator of theXContentParserthat parsing hit a deprecated field.
-
-
Field Summary
Fields Modifier and Type Field Description static DeprecationHandlerIGNORE_DEPRECATIONSIgnores all deprecationsstatic DeprecationHandlerTHROW_UNSUPPORTED_OPERATIONThrows anUnsupportedOperationExceptionwhen parsing hits a deprecated field.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidusedDeprecatedField(java.lang.String parserName, java.util.function.Supplier<XContentLocation> location, java.lang.String usedName)Called when the provided field name matches the current field but the entire field has been marked as deprecated with no replacementvoidusedDeprecatedField(java.lang.String parserName, java.util.function.Supplier<XContentLocation> location, java.lang.String usedName, java.lang.String replacedWith)Called when the provided field name matches the current field but the entire field has been marked as deprecated and another field should be usedvoidusedDeprecatedName(java.lang.String parserName, java.util.function.Supplier<XContentLocation> location, java.lang.String usedName, java.lang.String modernName)Called when the provided field name matches a deprecated name for the field.
-
-
-
Field Detail
-
THROW_UNSUPPORTED_OPERATION
static final DeprecationHandler THROW_UNSUPPORTED_OPERATION
Throws anUnsupportedOperationExceptionwhen parsing hits a deprecated field. Use this when creating anXContentParserthat won't interact with deprecation logic at all or when you want to fail fast when parsing deprecated fields.
-
IGNORE_DEPRECATIONS
static final DeprecationHandler IGNORE_DEPRECATIONS
Ignores all deprecations
-
-
Method Detail
-
usedDeprecatedName
void usedDeprecatedName(java.lang.String parserName, java.util.function.Supplier<XContentLocation> location, java.lang.String usedName, java.lang.String modernName)Called when the provided field name matches a deprecated name for the field.- Parameters:
usedName- the provided field namemodernName- the modern name for the field
-
usedDeprecatedField
void usedDeprecatedField(java.lang.String parserName, java.util.function.Supplier<XContentLocation> location, java.lang.String usedName, java.lang.String replacedWith)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:
usedName- the provided field namereplacedWith- the name of the field that replaced this field
-
usedDeprecatedField
void usedDeprecatedField(java.lang.String parserName, java.util.function.Supplier<XContentLocation> location, java.lang.String usedName)Called when the provided field name matches the current field but the entire field has been marked as deprecated with no replacement- Parameters:
usedName- the provided field name
-
-