Package org.elasticsearch.common
Class ParseField
- java.lang.Object
-
- org.elasticsearch.common.ParseField
-
public class ParseField extends Object
Holds a field that can be found in a request while parsing and its different variants, which may be deprecated.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classParseField.CommonFields
-
Constructor Summary
Constructors Constructor Description ParseField(String name, String... deprecatedNames)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String[]getAllNamesIncludedDeprecated()StringgetAllReplacedWith()String[]getDeprecatedNames()StringgetPreferredName()booleanmatch(String fieldName, DeprecationHandler deprecationHandler)DoesfieldNamematch this field?StringtoString()ParseFieldwithAllDeprecated(String allReplacedWith)Return a new ParseField where all field names are deprecated and replaced withallReplacedWith.ParseFieldwithDeprecation(String... deprecatedNames)
-
-
-
Constructor Detail
-
ParseField
public ParseField(String name, String... deprecatedNames)
- Parameters:
name- the primary name for this field. This will be returned bygetPreferredName()deprecatedNames- names for this field which are deprecated and will not be accepted when strict matching is used.
-
-
Method Detail
-
getPreferredName
public String getPreferredName()
- Returns:
- the preferred name used for this field
-
getAllNamesIncludedDeprecated
public String[] getAllNamesIncludedDeprecated()
- Returns:
- All names for this field regardless of whether they are deprecated
-
withDeprecation
public ParseField withDeprecation(String... deprecatedNames)
- Parameters:
deprecatedNames- deprecated names to include with the returnedParseField- Returns:
- a new
ParseFieldusing the preferred name from this one but with the specified deprecated names
-
withAllDeprecated
public ParseField withAllDeprecated(String allReplacedWith)
Return a new ParseField where all field names are deprecated and replaced withallReplacedWith.
-
match
public boolean match(String fieldName, DeprecationHandler deprecationHandler)
DoesfieldNamematch this field?- Parameters:
fieldName- the field name to match against thisParseFielddeprecationHandler- called iffieldNameis deprecated- Returns:
- true if
fieldNamematches any of the acceptable names for thisParseField.
-
getAllReplacedWith
public String getAllReplacedWith()
- Returns:
- the message to use if this
ParseFieldhas been entirely deprecated in favor of something else. This method will returnnullif the ParseField has not been completely deprecated.
-
getDeprecatedNames
public String[] getDeprecatedNames()
- Returns:
- an array of the names for the
ParseFieldwhich are deprecated.
-
-