5.4 - Annotations

The header definition file not only is a subclass of JHeader but must also use some annotations. Annotations are there to mark certain methods as being special and supply some static parameters. Here is a complete list of all annotations that can be used in header definition and support classes.

  • @Header - marks a class as being a header, may specify nicname and static length of the header
  • @HeaderLength - if header length is not static, a method can be specified that will calculate and return the length of the header at runtime
  • @Field - marks a field. This annotation actually creates a field and a field value getter. It also allows several field properties to be specified statically.
  • @Dynamic - marks a method as one providing some kind of field property dynamically at runtime. For example the field's description property can be returned from a method dynamically instead of being supplied statically.
  • @FieldSetter - marks a method as one that changes the value of the field within the header.
  • @Bind - protocol to protocol binding. The static method checks if source protocol is bound to a target protocol and returns a boolean flag.
  • @Scanner - allows forward bindings to occur. The scanner method overrides the actual protocol scan method natively and allows a java counter part to replace it. Its more complex but much more powerful and efficient way to do protocol to protocol bindings and header length discovery, all in one step.