Class ParseField


public class ParseField
extends java.lang.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 class  ParseField.CommonFields  
  • Constructor Summary

    Constructor Description
    ParseField​(java.lang.String name, java.lang.String... deprecatedNames)  
  • Method Summary

    Modifier and Type Method Description
    java.lang.String[] getAllNamesIncludedDeprecated()  
    java.lang.String getAllReplacedWith()  
    java.lang.String[] getDeprecatedNames()  
    java.lang.String getPreferredName()  
    boolean match​(java.lang.String fieldName, DeprecationHandler deprecationHandler)
    Does fieldName match this field?
    java.lang.String toString()  
    ParseField withAllDeprecated​(java.lang.String allReplacedWith)
    Return a new ParseField where all field names are deprecated and replaced with allReplacedWith.
    ParseField withDeprecation​(java.lang.String... deprecatedNames)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ParseField

      public ParseField​(java.lang.String name, java.lang.String... deprecatedNames)
      name - the primary name for this field. This will be returned by getPreferredName()
      deprecatedNames - names for this field which are deprecated and will not be accepted when strict matching is used.
  • Method Details

    • getPreferredName

      public java.lang.String getPreferredName()
      the preferred name used for this field
    • getAllNamesIncludedDeprecated

      public java.lang.String[] getAllNamesIncludedDeprecated()
      All names for this field regardless of whether they are deprecated
    • withDeprecation

      public ParseField withDeprecation​(java.lang.String... deprecatedNames)
      deprecatedNames - deprecated names to include with the returned ParseField
      a new ParseField using the preferred name from this one but with the specified deprecated names
    • withAllDeprecated

      public ParseField withAllDeprecated​(java.lang.String allReplacedWith)
      Return a new ParseField where all field names are deprecated and replaced with allReplacedWith.
    • match

      public boolean match​(java.lang.String fieldName, DeprecationHandler deprecationHandler)
      Does fieldName match this field?
      fieldName - the field name to match against this ParseField
      deprecationHandler - called if fieldName is deprecated
      true if fieldName matches any of the acceptable names for this ParseField.
    • toString

      public java.lang.String toString()
      toString in class java.lang.Object
    • getAllReplacedWith

      public java.lang.String getAllReplacedWith()
      the message to use if this ParseField has been entirely deprecated in favor of something else. This method will return null if the ParseField has not been completely deprecated.
    • getDeprecatedNames

      public java.lang.String[] getDeprecatedNames()
      an array of the names for the ParseField which are deprecated.