public final class DynamicStructureImpl extends java.lang.Object implements DynamicStructure, java.io.Serializable
DynamicStructure
implementation backed by a StructValue
.Constructor and Description |
---|
DynamicStructureImpl(StructValue strValue)
Constructor.
|
DynamicStructureImpl(StructValue strValue,
com.vmware.vapi.internal.bindings.TypeConverter converter)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
<T extends Structure> |
_convertTo(java.lang.Class<T> clazz)
Converts this structure into an instance of the provided class structure
if possible.
|
java.lang.String |
_getCanonicalName()
Returns the canonical name of the structure.
|
StructValue |
_getDataValue()
Returns this
Structure represented in the dynamic
DataValue model. |
boolean |
_hasTypeNameOf(java.lang.Class<? extends Structure> clazz)
Checks if the runtime type name of this structure matches the type
represented by the specified binding class.
|
boolean |
equals(java.lang.Object other) |
<T> T |
getField(java.lang.String fieldName,
java.lang.Class<T> targetClass)
Gets a field value, represented as static bindings type.
|
int |
hashCode() |
<T> void |
setField(java.lang.String fieldName,
T newValue,
java.lang.Class<T> valueClass)
Sets a field value, represented as static bindings type.
|
java.lang.String |
toString() |
public DynamicStructureImpl(StructValue strValue)
strValue
- the runtime struct value to be converted; must not be
null
public DynamicStructureImpl(StructValue strValue, com.vmware.vapi.internal.bindings.TypeConverter converter)
strValue
- the runtime struct value to be converted; must not be
null
converter
- for conversion from/to native types; must not be
null
public StructValue _getDataValue()
Structure
Structure
represented in the dynamic
DataValue
model.
Attempts to change the returned StructValue
representation are not required to change the state of this structure.
Actually the behavior is implementation dependent and is unspecified.
In general the returned value shouldn't be changed.
_getDataValue
in interface Structure
StructValue
representing this structurepublic <T> T getField(java.lang.String fieldName, java.lang.Class<T> targetClass)
DynamicStructure
getField
in interface DynamicStructure
T
- static binding type for the field valuefieldName
- name of the field to gettargetClass
- Class
for the result field valuepublic <T> void setField(java.lang.String fieldName, T newValue, java.lang.Class<T> valueClass)
DynamicStructure
setField
in interface DynamicStructure
T
- static binding type for the field valuefieldName
- name of the field to setnewValue
- new value for fieldName
fieldvalueClass
- Class
of newValue
public boolean _hasTypeNameOf(java.lang.Class<? extends Structure> clazz)
Structure
This can be used as efficient check to determine if this instance
can be successfully converted
to the target
type.
_hasTypeNameOf
in interface Structure
clazz
- bindings class for the target structure; must not be null
public <T extends Structure> T _convertTo(java.lang.Class<T> clazz)
Structure
_convertTo
in interface Structure
clazz
- type of the result structure. cannot be null.CoreException
is thrown otherwise.public java.lang.String _getCanonicalName()
Structure
org.example.FooBar
would turn into
org.example.foo_bar
._getCanonicalName
in interface Structure
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object