com.fasterxml.jackson.annotation

Enum JsonProperty.Access

  • All Implemented Interfaces:
    Serializable, Comparable<JsonProperty.Access>
    Enclosing class:
    JsonProperty


    public static enum JsonProperty.Access
    extends Enum<JsonProperty.Access>
    Various options for JsonProperty.access() property, specifying how property may be accessed during serialization ("read") and deserialization ("write") (note that the direction of read and write is from perspective of the property, not from external data format: this may be confusing in some contexts).

    Note that while this annotation modifies access to annotated property, its effects may be further overridden by JsonIgnore property: if both annotations are present on an accessors, JsonIgnore has precedence over this property. This annotation property is, however, preferred over use of "split" JsonIgnore/JsonProperty combination.

    Since:
    2.6
    • Enum Constant Summary

      Enum Constants 
      Enum Constant and Description
      AUTO
      Access setting which means that visibility rules are to be used to automatically determine read- and/or write-access of this property.
      READ_ONLY
      Access setting that means that the property may only be read for serialization, but not written (set) during deserialization.
      READ_WRITE
      Access setting that means that the property will be accessed for both serialization (writing out values as external representation) and deserialization (reading values from external representation), regardless of visibility rules.
      WRITE_ONLY
      Access setting that means that the property may only be written (set) for deserialization, but will not be read (get) on serialization, that is, the value of the property is not included in serialization.
    • Enum Constant Detail

      • AUTO

        public static final JsonProperty.Access AUTO
        Access setting which means that visibility rules are to be used to automatically determine read- and/or write-access of this property.
      • READ_ONLY

        public static final JsonProperty.Access READ_ONLY
        Access setting that means that the property may only be read for serialization, but not written (set) during deserialization.
      • WRITE_ONLY

        public static final JsonProperty.Access WRITE_ONLY
        Access setting that means that the property may only be written (set) for deserialization, but will not be read (get) on serialization, that is, the value of the property is not included in serialization.
      • READ_WRITE

        public static final JsonProperty.Access READ_WRITE
        Access setting that means that the property will be accessed for both serialization (writing out values as external representation) and deserialization (reading values from external representation), regardless of visibility rules.
    • Method Detail

      • values

        public static JsonProperty.Access[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (JsonProperty.Access c : JsonProperty.Access.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static JsonProperty.Access valueOf(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null

Copyright © 2008–2018 FasterXML. All rights reserved.