Skip to content

Annotation Interface IrisSpec

Javadoc 27 generates this reference during each site build from the exported packages and the annotation processor. The Java guide shows the API in use.

@Documented @Retention(SOURCE) @Target(TYPE) public @interface IrisSpec
Generates typed handles and a record for the reader spec in a file, at compile time.

On a top-level type Jobshop, IrisSpecProcessor reads the file, checks the reader spec, and writes two classes beside the type:

  • JobshopHandles, with the parsed Spec as spec, a typed handle for each entry, named and typed as iris gen --lang java names and types it, and a RecordReader as reader;
  • JobshopData, a record with a component for each entry, which reader reads.
@IrisSpec("formats/jobshop/jobshop.iris")
final class Jobshop {}

Data data = JobshopHandles.spec.read(input);
List<long[]> machine = data.get(JobshopHandles.machine);
JobshopData shop = JobshopHandles.reader.read(input);

A spec whose entries take more than 254 parameter slots in a record, where a long or double component takes two, gets no record and no reader, since a constructor takes at most 254; the processor notes it.

A relative path resolves against the directory that the processor option iris.root names, as in -Airis.root=/path/to/project, or without the option against the directory of the annotated type's source file. The generated classes keep the text of the spec, so the file is not needed at run time; a build that should regenerate them when the file changes declares it as an input of the compilation.

The annotation is kept only in the source, so the processor's jar is needed only to compile.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The path of the reader spec.
  • Element Details

    • value

      String value
      The path of the reader spec.
      Returns:
      the path, absolute or relative as the annotation's documentation says