Enum JsonProperty.Access

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

    public static enum JsonProperty.Access
    extends java.lang.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 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 (value accessed via "getter" Method, or read from Field) 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) as part of deserialization (using "setter" method, or assigning to Field, or passed as Creator argument) but will not be read (get) for serialization, that is, the value of the property is not included in serialization.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static JsonProperty.Access valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static JsonProperty.Access[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • 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 (value accessed via "getter" Method, or read from Field) but not written (set) during deserialization. Put another way, this would reflect "read-only POJO", in which value contained may be read but not written/set.
      • WRITE_ONLY

        public static final JsonProperty.Access WRITE_ONLY
        Access setting that means that the property may only be written (set) as part of deserialization (using "setter" method, or assigning to Field, or passed as Creator argument) but will not be read (get) for 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​(java.lang.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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null