Class LegType
- java.lang.Object
-
- com.opencloud.util.AbstractDataObject
-
- com.opencloud.util.AbstractFieldsObject
-
- AbstractEncodedDataObject<T>
-
- AbstractLazyEncodedDataObject<T>
-
- AbstractLazyEncodedNamedInteger<LegType.EncodedValue>
-
- com.opencloud.slee.resources.in.datatypes.cc.LegType
-
- All Implemented Interfaces:
DataObject
,FastSerializable
,Serializable
public final class LegType extends AbstractLazyEncodedNamedInteger<LegType.EncodedValue> implements FastSerializable
Class LegType identifies a specific party in a call. For all operations containing a LegType:- LegType = 1 shall always refer to the calling party, more specifically that party in the call present when InitialDP is sent to the SCF.
- LegType = 2 shall always refer to a called party, more specifically a party in the call created as a result of the InitialDP operation, followed by the Connect, Continue, ContinueWithArgument operation.
- LegType > 2 shall always refer to a called party, more specifically a party in the call created as a result of the InitiateCallAttempt operation, followed by the ContinueWithArgument operation.
The API offered by this class is as if the type were specified in ASN.1 as follows.
LegType ::= SEQUENCE { encodedValue EncodedValue }
EncodedValue is a NamedInteger. For each named value of the type,
n
, the API defines three Java static fields: aDataObject n
, aNamedInteger EncodedValue.n
, and anint EncodedValue._n
.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LegType.EncodedValue
Leg type constants.
-
Field Summary
Fields Modifier and Type Field Description static LegType
CALLED_PARTY
Constant for called party.static LegType
CALLING_PARTY
Constant for calling party.-
Fields inherited from class com.opencloud.slee.resources.cgin.AbstractLazyEncodedDataObject
isDecoded
-
Fields inherited from class com.opencloud.slee.resources.cgin.AbstractEncodedDataObject
encoded
-
Fields inherited from class com.opencloud.util.AbstractFieldsObject
FIELD_ABSENT, FIELD_UNINITIALISED
-
-
Constructor Summary
Constructors Constructor Description LegType()
Constructs a new LegType object with no fields set.LegType(byte[] data)
Constructs a new LegType object from network-encoded data.LegType(byte[] data, int start, int len)
Constructs a new LegType object from part of network-encoded data.LegType(int arg)
Constructs a new LegType object from the given int, making it be read-only (immutable).LegType(LegType.EncodedValue encodedValue)
Constructs a new LegType object from given values for all fields.LegType(DataInput in)
Constructs a new LegType object from data deserialized from a stream that was written bytoStream(DataOutput)
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkFieldsSet()
Checks that all mandatory fields are present.LegType
clone()
Constructs a copy of this object and everything reachable from it.static LegType
copyOf(LegType from)
Creates a new object of this type, cloning the values of common fields from the given object of any subclass of the same base type.protected void
decode()
Computes the decoded form from the encoded form.static LegType
decodeLegType(Integer encoded)
Helper method to decode Ericsson LegType fields encoded as ASN.1 integers.protected void
encode()
Computes the encoded form from the decoded form.protected boolean
encodedIsInvalid()
Determines whether the encoded form is invalid.static Integer
encodeLegType(LegType legType)
Helper method to encode Ericsson LegType fields as ASN.1 integers.protected LegType.EncodedValue
fromValue(int value)
Converts an int to a NamedInteger.byte[]
getByteArrayForm()
Gets the byte array encoded form.LegType.EncodedValue
getEncodedForm()
Gets the encoded form.LegType.EncodedValue
getEncodedValue()
Gets the value of the leg type value.static FieldAccessor[]
getFieldAccessors()
Gets a new array of the accessors for fields of this type.Map<String,Object>
getFieldsMap(boolean withAbsents)
Gets a Map from field-name to field-value for the fields of a sequence.boolean
hasEncodedValue()
Tests whether the field EncodedValue has a value.LegType
setEncodedValue(LegType.EncodedValue value)
Sets the value of the leg type value.void
toStream(DataOutput out)
Serializes this object to a stream in a form suitable for reading byLegType(DataInput)
.-
Methods inherited from class com.opencloud.slee.resources.cgin.AbstractLazyEncodedDataObject
checkDecode, checkModifyAndDecode
-
Methods inherited from class com.opencloud.util.AbstractFieldsObject
equals, hashCode, toString
-
Methods inherited from class com.opencloud.util.AbstractDataObject
checkModify, isReadOnly, setReadOnly
-
-
-
-
Constructor Detail
-
LegType
public LegType()
Constructs a new LegType object with no fields set.
-
LegType
public LegType(byte[] data)
Constructs a new LegType object from network-encoded data. The data is not decoded and might not be decodable.- Parameters:
data
- network-encoded data- Throws:
NullPointerException
- if data is null
-
LegType
public LegType(byte[] data, int start, int len)
Constructs a new LegType object from part of network-encoded data. The part starts at indexstart
and islen
bytes long. The data is not decoded and might not be decodable.- Parameters:
data
- network-encoded datastart
- starting offset of network-encoded data in byte arraylen
- default length if not predictable- Throws:
NullPointerException
- if data is nullIllegalArgumentException
- if len is negative
-
LegType
public LegType(LegType.EncodedValue encodedValue)
Constructs a new LegType object from given values for all fields.- Parameters:
encodedValue
- the leg type value
-
LegType
public LegType(int arg)
Constructs a new LegType object from the given int, making it be read-only (immutable).- Parameters:
arg
- int
-
LegType
public LegType(DataInput in) throws IOException
Constructs a new LegType object from data deserialized from a stream that was written bytoStream(DataOutput)
.- Parameters:
in
- the stream to read from- Throws:
EOFException
- if reading is pre-empted by end-of-fileIOException
- if the data cannot be read
-
-
Method Detail
-
toStream
public void toStream(DataOutput out) throws IOException
Serializes this object to a stream in a form suitable for reading byLegType(DataInput)
.- Specified by:
toStream
in interfaceFastSerializable
- Parameters:
out
- the stream to write to- Throws:
IOException
- if an I/O error occurs
-
hasEncodedValue
public boolean hasEncodedValue() throws DecodeException
Tests whether the field EncodedValue has a value.- Returns:
- whether the field has a value
- Throws:
DecodeException
- if encoded state cannot be decoded
-
checkFieldsSet
public void checkFieldsSet() throws EncodeException
Checks that all mandatory fields are present. Should be called immediately before all calls to encode().- Specified by:
checkFieldsSet
in classAbstractLazyEncodedDataObject<LegType.EncodedValue>
- Throws:
EncodeException
- if any mandatory field is not present
-
getEncodedValue
public LegType.EncodedValue getEncodedValue() throws DecodeException
Gets the value of the leg type value.- Returns:
- EncodedValue representation of the leg type value
- Throws:
DecodeException
- if encoded state cannot be decoded
-
setEncodedValue
public LegType setEncodedValue(LegType.EncodedValue value) throws IllegalStateException
Sets the value of the leg type value.- Parameters:
value
- EncodedValue representation of the leg type value- Returns:
- this
- Throws:
IllegalStateException
-
copyOf
public static LegType copyOf(LegType from)
Creates a new object of this type, cloning the values of common fields from the given object of any subclass of the same base type.- Parameters:
from
- the object from which to copy- Returns:
- LegType
-
clone
public LegType clone()
Constructs a copy of this object and everything reachable from it.- Specified by:
clone
in interfaceDataObject
- Specified by:
clone
in classAbstractDataObject
- Returns:
- copy of object
-
getFieldAccessors
public static FieldAccessor[] getFieldAccessors()
Gets a new array of the accessors for fields of this type.- Returns:
- FieldAccessor[]
-
getFieldsMap
public Map<String,Object> getFieldsMap(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.- Specified by:
getFieldsMap
in classAbstractFieldsObject
- Parameters:
withAbsents
- whether to put absent optional fields into Map- Returns:
- Map from field-name to field-value
-
encodedIsInvalid
protected boolean encodedIsInvalid()
Determines whether the encoded form is invalid.- Returns:
- boolean
-
getEncodedForm
public LegType.EncodedValue getEncodedForm() throws EncodeException
Gets the encoded form.- Returns:
- encoded form
- Throws:
EncodeException
- if encoding fails
-
getByteArrayForm
public byte[] getByteArrayForm() throws EncodeException
Gets the byte array encoded form. The size of the array is the least of 1, 2, 4, or 8 according to the type's bounds. The most significant byte of the numeric value is in the lowest indexed byte of the array.- Returns:
- byte array form
- Throws:
EncodeException
- if encoding fails
-
fromValue
protected LegType.EncodedValue fromValue(int value)
Converts an int to a NamedInteger. Reuses any existing instance where possible.- Specified by:
fromValue
in classAbstractLazyEncodedNamedInteger<LegType.EncodedValue>
- Parameters:
value
- int- Returns:
- NamedInteger
-
encode
protected void encode() throws EncodeException
Computes the encoded form from the decoded form.- Specified by:
encode
in classAbstractLazyEncodedDataObject<LegType.EncodedValue>
- Throws:
EncodeException
- if EncodedValue is not in range [0,255]
-
decode
protected void decode() throws DecodeException
Computes the decoded form from the encoded form.- Specified by:
decode
in classAbstractLazyEncodedDataObject<LegType.EncodedValue>
- Throws:
DecodeException
- if decoding fails
-
decodeLegType
public static LegType decodeLegType(Integer encoded)
Helper method to decode Ericsson LegType fields encoded as ASN.1 integers.
-
-