Package org.tomlj

Annotation Interface TomlName


@Documented @Retention(RUNTIME) @Target(FIELD) public @interface TomlName
The name in TOML of a field, record component or enum constant, for TomlTable.as(Class) and MutableTomlTable.from(Object).

On a field or component, it is the key the field or component is bound to. Without this annotation the key is the name of the field or component, converted by the key naming of the options. With it, the key is the annotation's value, and the key naming is not applied.

 record Server(@TomlName("host-name") String host, int port) {}
 

On an enum constant, it is the string the constant is written as and matched by, in place of its name.

 enum Trigger {
   @TomlName("always")
   RUN_ALWAYS, ON_SUCCESS
 }
 
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The name.
  • Element Details

    • value

      String value
      The name.
      Returns:
      For a field or component, a single key, not a dotted key. It is used as written, without quoting or escaping, so @TomlName("a.b") names the key "a.b" and not the key b in the table a. For an enum constant, the string.