|
| 1 | +package com.igormaznitsa.jbbp.utils; |
| 2 | + |
| 3 | +import com.igormaznitsa.jbbp.io.JBBPByteOrder; |
| 4 | + |
| 5 | +import java.lang.annotation.ElementType; |
| 6 | +import java.lang.annotation.Inherited; |
| 7 | +import java.lang.annotation.Retention; |
| 8 | +import java.lang.annotation.RetentionPolicy; |
| 9 | +import java.lang.annotation.Target; |
| 10 | + |
| 11 | +/** |
| 12 | + * Annotation allows to mark a field as custom data type for DSL builder. |
| 13 | + * @since 1.4.1 |
| 14 | + * @see com.igormaznitsa.jbbp.utils.JBBPDslBuilder |
| 15 | + */ |
| 16 | +@Retention(RetentionPolicy.RUNTIME) |
| 17 | +@Target( {ElementType.FIELD, ElementType.TYPE}) |
| 18 | +@Inherited |
| 19 | +public @interface DslBinCustom { |
| 20 | + /** |
| 21 | + * Name of the field. |
| 22 | + * @return name of the field, if empty then undefined |
| 23 | + */ |
| 24 | + String name() default ""; |
| 25 | + |
| 26 | + /** |
| 27 | + * Name of the custom type. |
| 28 | + * @return type of the field, if empty then undefined |
| 29 | + */ |
| 30 | + String type() default ""; |
| 31 | + |
| 32 | + /** |
| 33 | + * Byte order for the field. |
| 34 | + * @return byte order of data represented by the field |
| 35 | + */ |
| 36 | + JBBPByteOrder byteOrder() default JBBPByteOrder.BIG_ENDIAN; |
| 37 | + |
| 38 | + /** |
| 39 | + * Expression to be placed in extra part of type. It means type[:extra] |
| 40 | + * @return extra value, if empty then undefined |
| 41 | + */ |
| 42 | + String extraExpression() default ""; |
| 43 | + |
| 44 | + /** |
| 45 | + * Expression to represent array size of the field. |
| 46 | + * @return array size of the field, if empty then not defined |
| 47 | + */ |
| 48 | + String arraySizeExpression() default ""; |
| 49 | + |
| 50 | + /** |
| 51 | + * Order of the field. |
| 52 | + * @return order of the field. |
| 53 | + */ |
| 54 | + int order() default 0; |
| 55 | + |
| 56 | + /** |
| 57 | + * Field allows provide some comment. |
| 58 | + * @return comment for the annotation |
| 59 | + */ |
| 60 | + String comment() default ""; |
| 61 | +} |
0 commit comments