Class Error
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- com.vmware.vapi.bindings.ApiError
-
- com.vmware.vapi.std.errors.Error
-
- All Implemented Interfaces:
StaticStructure
,Structure
,java.io.Serializable
- Direct Known Subclasses:
AlreadyExists
,AlreadyInDesiredState
,Canceled
,ConcurrentChange
,FeatureInUse
,InternalServerError
,InvalidArgument
,InvalidElementConfiguration
,InvalidElementType
,InvalidRequest
,NotAllowedInCurrentState
,NotFound
,OperationNotFound
,ResourceBusy
,ResourceInaccessible
,ResourceInUse
,ServiceUnavailable
,TimedOut
,UnableToAllocateResource
,Unauthenticated
,Unauthorized
,UnexpectedInput
,Unsupported
,UnverifiedPeer
public class Error extends ApiError implements java.io.Serializable, StaticStructure
TheError
exception describes theproperties common to all standard exceptions.This exception serves two purposes:
- It is the
exception that clients in many programming languages can catch to handle all
standard exceptions. Typically those clients will display one or more of the
localizable messages from
getMessages()
to a human. - It is the exception that methods can report when they need to report some exception, but the exception doesn't fit into any other standard exception, and in fact the only reasonable way for a client to react to the exception is to display the message(s) to a human.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Error.Builder
Builder class forError
.static class
Error.Type
Enumeration of all standard errors.
-
Field Summary
Fields Modifier and Type Field Description protected StructValue
__dynamicStructureFields
-
Constructor Summary
Constructors Modifier Constructor Description Error()
Default constructor.protected
Error(StructValue __dynamicStructureFields)
protected
Error(StructValue __dynamicStructureFields, Error.Type errorType)
Error(java.util.List<LocalizableMessage> messages, Structure data)
This constructor is provided for backwards compatibility purposes only.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends Structure>
T_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.static java.lang.String
_getCanonicalTypeName()
Returns the canonical type name.static com.vmware.vapi.bindings.type.ErrorType
_getClassType()
WARNING: Internal method, subject to change in future versions.StructValue
_getDataValue()
Returns thisStructure
represented in the dynamicDataValue
model.DataValue
_getDynamicField(java.lang.String fieldName)
Get a dynamic field value, doesn't allow access to static fields (which have getters/setters).java.util.Set<java.lang.String>
_getDynamicFieldNames()
Get the names of the dynamic fields in the structure.com.vmware.vapi.bindings.type.ErrorType
_getType()
WARNING: Internal method, subject to change in future versions.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.static Error
_newInstance(StructValue structValue)
WARNING: Internal method, subject to change in future versions.
Returns new instance of this binding class and injects the provided data value.
WARNING: The returned object is not fully initialized.static Error
_newInstance2(StructValue structValue)
WARNING: Internal method, subject to change in future versions.
Serves as a versioning mechanism.void
_setDynamicField(java.lang.String fieldName, DataValue fieldValue)
Sets a dynamic field value.protected void
_updateDataValue(StructValue structValue)
void
_validate()
Validates the state of the discriminated unions and HasFieldsOf restrictions (if any) in this Java language bindingStructure
.boolean
equals(java.lang.Object obj)
Structure
getData()
Data to facilitate clients responding to the method reporting a standard exception to indicating that it was unable to complete successfully.Error.Type
getErrorType()
Discriminator field to help API consumers identify the structure type.java.lang.String
getMessage()
java.util.List<LocalizableMessage>
getMessages()
Stack of one or more localizable messages for human exception consumers.int
hashCode()
void
setData(Structure data)
Data to facilitate clients responding to the method reporting a standard exception to indicating that it was unable to complete successfully.void
setMessages(java.util.List<LocalizableMessage> messages)
Stack of one or more localizable messages for human exception consumers.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.vmware.vapi.bindings.StaticStructure
toString
-
-
-
-
Field Detail
-
__dynamicStructureFields
protected StructValue __dynamicStructureFields
-
-
Constructor Detail
-
Error
public Error(java.util.List<LocalizableMessage> messages, Structure data)
This constructor is provided for backwards compatibility purposes only. Please use the Builder class instead.
-
Error
public Error()
Default constructor.
-
Error
protected Error(StructValue __dynamicStructureFields)
-
Error
protected Error(StructValue __dynamicStructureFields, Error.Type errorType)
-
-
Method Detail
-
getMessages
public java.util.List<LocalizableMessage> getMessages()
Stack of one or more localizable messages for human exception consumers.The message at the top of the stack (first in the list) describes the exception from the perspective of the method the client invoked.
Each subsequent message in the stack describes the "cause" of the prior message.
- Returns:
- The current value of the property.
-
setMessages
public void setMessages(java.util.List<LocalizableMessage> messages)
Stack of one or more localizable messages for human exception consumers.The message at the top of the stack (first in the list) describes the exception from the perspective of the method the client invoked.
Each subsequent message in the stack describes the "cause" of the prior message.
- Parameters:
messages
- New value for the property.
-
getData
public Structure getData()
Data to facilitate clients responding to the method reporting a standard exception to indicating that it was unable to complete successfully.Methods may provide data that clients can use when responding to exceptions. Since the data that clients need may be specific to the context of the method reporting the exception, different methods that report the same exception may provide different data in the exception. The documentation for each each method will describe what, if any, data it provides for each exception it reports.
The
Some methods will not set this property when reporting exceptions.ArgumentLocations
,FileLocations
, andTransientIndication
classes are intended as possible values for this property.DynamicID
may also be useful as a value for this property (although that is not its primary purpose). Some interfaces may provide their own specific classes for use as the value of this property when reporting exceptions from their methods.- Returns:
- The current value of the property.
-
setData
public void setData(Structure data)
Data to facilitate clients responding to the method reporting a standard exception to indicating that it was unable to complete successfully.Methods may provide data that clients can use when responding to exceptions. Since the data that clients need may be specific to the context of the method reporting the exception, different methods that report the same exception may provide different data in the exception. The documentation for each each method will describe what, if any, data it provides for each exception it reports.
The
Some methods will not set this property when reporting exceptions.ArgumentLocations
,FileLocations
, andTransientIndication
classes are intended as possible values for this property.DynamicID
may also be useful as a value for this property (although that is not its primary purpose). Some interfaces may provide their own specific classes for use as the value of this property when reporting exceptions from their methods.- Parameters:
data
- New value for the property.
-
getErrorType
public Error.Type getErrorType()
Discriminator field to help API consumers identify the structure type. The value of this property is automatically populated. Can benull
for compatibility with preceding implementations.- Returns:
- The current value of the property.
-
_getType
public com.vmware.vapi.bindings.type.ErrorType _getType()
Description copied from interface:StaticStructure
WARNING: Internal method, subject to change in future versions. ReturnsStructType
instance representing the static bindings type for thisStructure
.- Specified by:
_getType
in interfaceStaticStructure
- Returns:
- the static bindings
StructType
-
_getDataValue
public StructValue _getDataValue()
Description copied from interface:Structure
Returns thisStructure
represented in the dynamicDataValue
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.- Specified by:
_getDataValue
in interfaceStructure
- Returns:
StructValue
representing this structure
-
_updateDataValue
protected void _updateDataValue(StructValue structValue)
-
_validate
public void _validate()
Description copied from interface:StaticStructure
Validates the state of the discriminated unions and HasFieldsOf restrictions (if any) in this Java language bindingStructure
.More precisely, for each union: given value of the discriminant/tag field (
@UnionTag
in the IDL) of an union in this structure, validates that:- all fields of the union required for that value of the discriminant are set
- fields of the union that are not allowed for that value of the discriminant are not set
- any other fields of the structure (not participating in the union) do not affect the validation result
- Specified by:
_validate
in interfaceStaticStructure
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getMessage
public java.lang.String getMessage()
- Overrides:
getMessage
in classjava.lang.Throwable
-
_hasTypeNameOf
public boolean _hasTypeNameOf(java.lang.Class<? extends Structure> clazz)
Description copied from interface:Structure
Checks if the runtime type name of this structure matches the type represented by the specified binding class.This can be used as efficient check to determine if this instance can be successfully
converted
to the target type.- Specified by:
_hasTypeNameOf
in interfaceStructure
- Parameters:
clazz
- bindings class for the target structure; must not benull
- Returns:
- true if this structures type name matches exactly the specified class' type name.
-
_convertTo
public <T extends Structure> T _convertTo(java.lang.Class<T> clazz)
Description copied from interface:Structure
Converts this structure into an instance of the provided class structure if possible. A conversion will be possible if the requested structure's fields are all present in this structure.- Specified by:
_convertTo
in interfaceStructure
- Parameters:
clazz
- type of the result structure. cannot be null.- Returns:
- an instance of the requested type if conversion is possible.
CoreException
is thrown otherwise.
-
_setDynamicField
public void _setDynamicField(java.lang.String fieldName, DataValue fieldValue)
Description copied from interface:StaticStructure
Sets a dynamic field value. The dynamic filed is extra filed that is not part of the static structure definition, i.e. not represented with getter/setter.- Specified by:
_setDynamicField
in interfaceStaticStructure
- Parameters:
fieldName
- canonical name of the dynamic field to setfieldValue
- the value of the field
-
_getDynamicField
public DataValue _getDynamicField(java.lang.String fieldName)
Description copied from interface:StaticStructure
Get a dynamic field value, doesn't allow access to static fields (which have getters/setters).- Specified by:
_getDynamicField
in interfaceStaticStructure
- Parameters:
fieldName
- the canonical name of the dynamic field- Returns:
- the
DataValue
of the dynamic field
-
_getDynamicFieldNames
public java.util.Set<java.lang.String> _getDynamicFieldNames()
Description copied from interface:StaticStructure
Get the names of the dynamic fields in the structure.- Specified by:
_getDynamicFieldNames
in interfaceStaticStructure
- Returns:
- set of the canonical field names for the dynamic fields
-
_getClassType
public static com.vmware.vapi.bindings.type.ErrorType _getClassType()
WARNING: Internal method, subject to change in future versions.- Returns:
ErrorType
instance representing the static bindings type for thisError
.
-
_getCanonicalName
public java.lang.String _getCanonicalName()
Description copied from interface:Structure
Returns the canonical name of the structure. By default the canonical name is derived from the fully-qualified IDL name by converting to lower case and inserting underscores between words. For exampleorg.example.FooBar
would turn intoorg.example.foo_bar
.- Specified by:
_getCanonicalName
in interfaceStructure
- Returns:
- canonical name
-
_getCanonicalTypeName
public static java.lang.String _getCanonicalTypeName()
Returns the canonical type name. See_getCanonicalName()
.- Returns:
- canonical type name
-
_newInstance
public static Error _newInstance(StructValue structValue)
WARNING: Internal method, subject to change in future versions.
Returns new instance of this binding class and injects the provided data value.
WARNING: The returned object is not fully initialized.- Parameters:
structValue
- the source of the data contained in the binding object. Could contain more data than fields of this class can describe i.e. newer version of the binding object. Could be null.- Returns:
- the static bindings
StructType
-
_newInstance2
public static Error _newInstance2(StructValue structValue)
WARNING: Internal method, subject to change in future versions.
Serves as a versioning mechanism.
-
-