Annotation Type StringDef


  • @Retention(SOURCE)
    public @interface StringDef
    Defines a character string constant.

    This annotation is used within a StringPool annotation to define a single character string constant.

    A character string constant can be defined in one of the two following ways:

    • With a name and a value expressed as a Java string literal (as defined by the Java Language Specification).

      For example: @StringDef(name = "Hello", value = "Hello California!")

    • With a name and a reference to another string constant (typically defined in another library package) using its fully-qualified name.

      For example: @StringDef(name = "S2", reference = "com.sun.jcclassic.samples.stringlib.LibStrings.Hello")

    This annotation is processed at compile-time and is discarded by the compiler. That is, it is not retained within the compiled class file.

    Since:
    Java Card Classic 3.0.4
    See Also:
    StringPool
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      java.lang.String name
      The name of the defined string constant.
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      java.lang.String reference
      The fully-qualified name of the referenced string constant.
      java.lang.String value
      The literal value of the defined string constant.
    • Element Detail

      • name

        java.lang.String name
        The name of the defined string constant.
        Returns:
        -
      • value

        java.lang.String value
        The literal value of the defined string constant.

        This attribute is exclusive of the reference() attribute. The annotation processor will fail with an error message if both the value() and reference() attributes are defined.

        Returns:
        -
        Default:
        ""
      • reference

        java.lang.String reference
        The fully-qualified name of the referenced string constant.

        This attribute is exclusive of the value() attribute. The annotation processor will fail with an error message if both the value() and reference() attributes are defined.

        Returns:
        -
        Default:
        ""