import jp.bitmeister.asn1.type.builtin.SEQUENCE_OF;
import jp.bitmeister.asn1.type.builtin.SET;
import jp.bitmeister.asn1.type.builtin.SET_OF;
-import jp.bitmeister.asn1.value.HexString;
/**
* POJO to ASN.1 data decoder.
* asn1.type.builtin.BIT_STRING)
*/
public Void visit(BIT_STRING data) throws IllegalAccessException {
- data.set(new HexString((byte[]) element));
+ data.set((boolean[]) element);
return null;
}
import jp.bitmeister.asn1.type.builtin.SEQUENCE_OF;
import jp.bitmeister.asn1.type.builtin.SET;
import jp.bitmeister.asn1.type.builtin.SET_OF;
-import jp.bitmeister.asn1.value.BinString;
/**
* ASN.1 to POJO data encoder.
* asn1.type.builtin.BIT_STRING)
*/
public Object visit(BIT_STRING data) throws Exception {
- return new BinString(data.value()).toByteArray();
+ return data.value();
}
/*
* asn1.type.builtin.OCTET_STRING)
*/
public Object visit(OCTET_STRING data) throws Exception {
- byte[] value = new byte[data.size()];
- System.arraycopy(data.value(), 0, value, 0, value.length);
- return value;
+ return data.value();
}
/*
*
* <p>
* A field that annotated as {@code @ASN1JavaField} will be translated to a
- * particular element of corresponding ASN.1 type indicated by value parameter.
- * {@code @ASN1JavaField} field must be contained in a class that annotated as
- * {@code @ASN1JavaObject}. An {@code @ASN1JavaField} field must be a public,
- * non-static and non-final field.
+ * particular element of corresponding ASN.1 type indicated by the value
+ * parameter. {@code @ASN1JavaField} field must be contained in a class that
+ * annotated as {@code @ASN1JavaObject}. An {@code @ASN1JavaField} field must be
+ * a public, non-static and non-final field.
* </p>
*
* <p>
* </tr>
* <tr>
* <td>BIT_STRING</td>
- * <td>byte[]</td>
+ * <td>boolean[]</td>
* </tr>
* <tr>
* <td>OCTET_STRING</td>
public class FrightStatusMain {
public static void main(String[] args) {
-
AllFrights frights = new AllFrights(
new FrightStatus(
new FrightNumber("JP041"),
* @see ASN1ModuleRef
*/
public abstract class ASN1Module {
-
+
/**
* Returns the default tagging mode of the ASN.1 module.
*
}
}
}
-
+
}
* The {@code Class} object of an {@code ASN1Module}.
* @return A {@code ModuleSpecification} instance.
*/
- static ModuleSpecification specification(Class<? extends ASN1Module> module) {
+ public static ModuleSpecification specification(Class<? extends ASN1Module> module) {
if (module == null) {
module = BuiltInModule.class;
}
public static String identifier(Class<? extends ASN1Module> module) {
return specification(module).identifier();
}
-
+
private Map<Class<? extends ASN1Module>, ModuleSpecification> definedModules = new HashMap<Class<? extends ASN1Module>, ModuleSpecification>();
/**
}
super.set(value);
}
-
+
/**
* Returns an identifier related to the value of this data if the type has
* {@code @ASN1Enumeration} fields.
}
/**
+ * Returns identifier of this module.
+ *
+ * @return Identifier.
+ */
+ String identifier() {
+ return identifier;
+ }
+
+ /**
+ * Returns default tag mode of this module.
+ *
+ * @return Default tag mode.
+ */
+ ASN1TagDefault tagDefault() {
+ return tagDefault;
+ }
+
+ /**
* Registers an imported module to this module.
*
* @param module
}
/**
- * Returns identifier of this module.
- *
- * @return Identifier.
- */
- String identifier() {
- return identifier;
- }
-
- /**
- * Returns default tag mode of this module.
- *
- * @return Default tag mode.
- */
- ASN1TagDefault tagDefault() {
- return tagDefault;
- }
-
- /**
* Instantiates an ASN.1 data specified by the tag.
*
* @param tagClass
public BigENUMERATED(long value) {
super(value);
}
+
+ /**
+ * Instantiates an {@code BigENUMERATED} and initialize it with the value that is
+ * specified by the identifier of namednumber.
+ *
+ * @param identifier
+ * Identifier of the number to be assigned.
+ */
+ public BigENUMERATED(String identifier) {
+ set(identifier);
+ }
/*
* (non-Javadoc)
}
/**
- * Instantiates an empty {@code INTEGER}.
+ * Instantiates an empty {@code BigINTEGER}.
*/
public BigINTEGER() {
}
/**
- * Instantiates an {@code INTEGER} and initialize it with the
+ * Instantiates an {@code BigINTEGER} and initialize it with the
* {@code BigInteger} value.
*
* @param value
}
/**
- * Instantiates an {@code INTEGER} and initialize it with the {@code long}
+ * Instantiates an {@code BigINTEGER} and initialize it with the {@code long}
* value.
*
* @param value
public BigINTEGER(long value) {
set(value);
}
+
+ /**
+ * Instantiates an {@code BigINTEGER} and initialize it with the value that is
+ * specified by the identifier of namednumber.
+ *
+ * @param identifier
+ * Identifier of the number to be assigned.
+ */
+ public BigINTEGER(String identifier) {
+ set(identifier);
+ }
/**
* Sets the {@code long} value to this data.
public ENUMERATED(long value) {
super(value);
}
+
+ /**
+ * Instantiates an {@code ENUMERATED} and initialize it with the value that is
+ * specified by the identifier of namednumber.
+ *
+ * @param identifier
+ * Identifier of the number to be assigned.
+ */
+ public ENUMERATED(String identifier) {
+ super(identifier);
+ }
/*
* (non-Javadoc)
}
/**
+ * Instantiates an {@code INTEGER} and initialize it with the value that is
+ * specified by the identifier of namednumber.
+ *
+ * @param identifier
+ * Identifier of the number to be assigned.
+ */
+ public INTEGER(String identifier) {
+ set(identifier);
+ }
+
+ /**
* Sets the int value to this data.
*
* @param value