Class FieldAccessorUtils
- java.lang.Object
-
- FieldAccessorUtils
-
public class FieldAccessorUtils extends Object
Provides various static utility methods on FieldAccessors.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FieldAccessor
fromArray(String name, FieldAccessor[] fieldAccessors)
Gets the FieldAccessor for the field with the given name from the given array of FieldAccessors.static Map<String,Object>
getChoiceFieldsMap(AbstractFieldsObject object, FieldAccessor[] fieldAccessors)
Gets a Map from :discriminant-name to field-value.static Map<String,Object>
getSequenceFieldsMap(AbstractFieldsObject object, FieldAccessor[] fieldAccessors, boolean withAbsents)
Gets a Map from field-name to field-value for the fields of a sequence.
-
-
-
Method Detail
-
fromArray
public static FieldAccessor fromArray(String name, FieldAccessor[] fieldAccessors)
Gets the FieldAccessor for the field with the given name from the given array of FieldAccessors.- Parameters:
name
- ASN.1 name of the field, after any @rename adaptationfieldAccessors
- FieldAccessor[]- Returns:
- FieldAccessor having the given name, or null if none
-
getSequenceFieldsMap
public static Map<String,Object> getSequenceFieldsMap(AbstractFieldsObject object, FieldAccessor[] fieldAccessors, boolean withAbsents)
Gets a Map from field-name to field-value for the fields of a sequence. For a field of primitive type, the field-value is boxed. For an absent optional field, the field-value is AbstractFieldsObject.FIELD_ABSENT. For an uninitialised mandatory field, the field-value is AbstractFieldsObject.FIELD_UNINITIALISED. For a field of String type, the encoded form is used if the String cannot be decoded. For a type that represents an OCTET STRING that cannot be decoded, a map from "encodedValue" to the byte array value is returned.- Parameters:
object
- that whose fields are to be accessedfieldAccessors
- FieldAccessor[]withAbsents
- whether to put absent optional fields into Map- Returns:
- Map from field-name to field-value
-
getChoiceFieldsMap
public static Map<String,Object> getChoiceFieldsMap(AbstractFieldsObject object, FieldAccessor[] fieldAccessors)
Gets a Map from :discriminant-name to field-value. If choice is not set, returns a Map from : to AbstractFieldsObject.FIELD_UNINITIALISED. For a field of primitive type, the field-value is boxed. For a field of String type, the encoded form is used if the String cannot be decoded. For a type that represents an OCTET STRING that cannot be decoded, a map from "encodedValue:" to the byte array value is returned.- Parameters:
object
- that whose fields are to be accessedfieldAccessors
- FieldAccessor[]- Returns:
- Map from :discriminant-name to field-value
-
-