jp.bitmeister.asn1.annotation
Annotation Type ASN1Element


@Target(value=FIELD)
@Retention(value=RUNTIME)
public @interface ASN1Element

Indicates that a field is an element of a structured type.

If an @ASN1Element annotation is present on a field, the field is treated as a component of a SEQUENCE type or a SET type. A field annotated as @ASN1Element must be declared as public non-final non-static, and the type shall be a sub-class of ASN1Type. The value parameter represents an order of appearance of a field in an ASN.1 type definition. The value parameter must be set even if a container type is a SET type. It will be used by the automatic tagging process.

For example, following ASN.1 definition :

 Sample ::= SET {
        number  INTEGER,
        bool    BOOLEAN OPTIONAL }
 
can be translated as :
 public class Sample extends SET {
 
        @ASN1ElementType(0)
        public INTEGER number;
 
        @ASN1ElementType(value = 1, optional = true)
        public BOOLEAN bool;
 
 }
 

Author:
WATANABE, Jun.
See Also:
ConstructiveType

Required Element Summary
 int value
          Indicates defined order of this element.
 
Optional Element Summary
 boolean hasDefault
          Indicates that the element has default value or not.
 boolean optional
          Indicates that the element is optional or not.
 

Element Detail

value

public abstract int value
Indicates defined order of this element.

Returns:
Order of this element.

optional

public abstract boolean optional
Indicates that the element is optional or not.

Returns:
true if the element is optional.
Default:
false

hasDefault

public abstract boolean hasDefault
Indicates that the element has default value or not.

Returns:
true if the element has default value.
Default:
false


Copyright © 2012 BitMeister Inc. All Rights Reserved.