I am working with “binary notes” a ASN.1 environment in Java.
First I created a class of an asn.1 sequence by hand.
@ASN1String(name = "", isUCS = false, stringType = UniversalTag.PrintableString)
@ASN1Element(name = "firstName", isOptional = false, hasTag = false, hasDefaultValue = false)
private String firstName = null;
Now I am wondering what that “@” sign means? I tried to find hints in the source of binary notes, and found the following:
package org.bn.annotations;
import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface ASN1String {
String name();
boolean isUCS();
int stringType();
}
Can someone explain the notation to me?
Would be nice. Thanks in advance.
nyyrikki
In Java, “@Foo” is an annotation. It’s intended for a part of your particular build environment to interpret it. Generally annotations get replaced with chunks of Java code.
More information on annotations: http://download.oracle.com/javase/1.5.0/docs/guide/language/annotations.html
My guess is that you need to look up documentation on ASN.1 to know what those specific annotations do.