Annotation Type SerializedNames


  • @Beta
    @Target(METHOD)
    @Retention(RUNTIME)
    public @interface SerializedNames
    This annotation identifies the canonical factory method on an AutoValue type used for json. It also dictates the serialized naming convention of the fields. This is required as there's currently no way to add annotations to the fields generated by AutoValue.

    Example:

    {@code @AutoValue class Resource {
       abstract String id();
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      String[] value
      Ordered values that dictate the naming convention for serialization.
    • Element Detail

      • value

        String[] value
        Ordered values that dictate the naming convention for serialization.

        Note

        The order of these names must exactly match the factory method parameters and also match the order of the auto-value constructor parameters.