public class StandardDataFactory
extends java.lang.Object
DataDefinition
s and DataValue
s for standard vAPI
structures, like errors and localizable messages.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ALREADY_EXISTS |
static java.lang.String |
ARGS_FIELD_NAME |
static java.lang.String |
DATA_FIELD_NAME |
static java.lang.String |
DEFAUL_MSG_FIELD_NAME |
static java.lang.String |
ID_FIELD_NAME |
static java.lang.String |
INTERNAL_SERVER_ERROR |
static java.lang.String |
INVALID_ARGUMENT |
static java.lang.String |
KEY_FIELD_NAME |
static java.lang.String |
LOCALIZED_FIELD_NAME |
static java.lang.String |
MAP_ENTRY_TYPE |
static java.lang.String |
MESSAGE_STRUCT_NAME |
static java.lang.String |
MESSAGES_FIELD_NAME |
static java.lang.String |
NESTED_MSG_STRUCT_NAME |
static java.lang.String |
NOT_FOUND |
static java.lang.String |
OPERATION_NOT_FOUND |
static java.lang.String |
PARAM_STRUCT_NAME |
static java.lang.String |
PARAMS_FIELD_NAME |
static java.util.Map<java.lang.String,com.vmware.vapi.data.DataDefinition> |
STANDARD_ERROR_FIELDS |
static java.lang.String |
TYPE_FIELD_NAME |
static java.lang.String |
UNAUTHENTICATED |
static java.lang.String |
UNEXPECTED_INPUT |
static java.lang.String |
VALUE_FIELD_NAME |
Constructor and Description |
---|
StandardDataFactory() |
Modifier and Type | Method and Description |
---|---|
static ErrorValue |
createErrorValueForMessages(com.vmware.vapi.data.ErrorDefinition errorDef,
java.util.List<com.vmware.vapi.Message> messages)
Creates instance for given error definition and list of
Message s. |
static ErrorValue |
createErrorValueForMessages(java.lang.String errorName,
java.util.List<com.vmware.vapi.Message> messages)
Creates a standard error
ErrorValue instance for the given
name list of Message s. |
static com.vmware.vapi.data.ErrorDefinition |
createStandardErrorDefinition(java.lang.String errorName)
Creates
ErrorDefinition s for standard vAPI errors. |
static com.vmware.vapi.data.StructDefinition |
getLocalizableMessageDefinition() |
static java.util.List<com.vmware.vapi.Message> |
getMessagesFromErrorValue(StructValue error)
Returns messages associated with the specified standard error
ErrorValue represented as list of Message s. |
public static final java.lang.String VALUE_FIELD_NAME
public static final java.lang.String KEY_FIELD_NAME
public static final java.lang.String MAP_ENTRY_TYPE
public static final java.lang.String ALREADY_EXISTS
public static final java.lang.String INTERNAL_SERVER_ERROR
public static final java.lang.String OPERATION_NOT_FOUND
public static final java.lang.String INVALID_ARGUMENT
public static final java.lang.String NOT_FOUND
public static final java.lang.String UNAUTHENTICATED
public static final java.lang.String UNEXPECTED_INPUT
public static final java.lang.String MESSAGE_STRUCT_NAME
public static final java.lang.String PARAM_STRUCT_NAME
public static final java.lang.String NESTED_MSG_STRUCT_NAME
public static final java.lang.String ID_FIELD_NAME
public static final java.lang.String DEFAUL_MSG_FIELD_NAME
public static final java.lang.String ARGS_FIELD_NAME
public static final java.lang.String LOCALIZED_FIELD_NAME
public static final java.lang.String PARAMS_FIELD_NAME
public static final java.lang.String MESSAGES_FIELD_NAME
public static final java.lang.String DATA_FIELD_NAME
public static final java.lang.String TYPE_FIELD_NAME
public static final java.util.Map<java.lang.String,com.vmware.vapi.data.DataDefinition> STANDARD_ERROR_FIELDS
public static com.vmware.vapi.data.StructDefinition getLocalizableMessageDefinition()
public static com.vmware.vapi.data.ErrorDefinition createStandardErrorDefinition(java.lang.String errorName)
ErrorDefinition
s for standard vAPI errors. This includes
definitions for nested data types such as LocalizableMessage
,
NestedLocalizableMessage
and LocalizationParam
too.errorName
- the error nameErrorDefinition
instancepublic static ErrorValue createErrorValueForMessages(java.lang.String errorName, java.util.List<com.vmware.vapi.Message> messages)
ErrorValue
instance for the given
name list of Message
s.public static ErrorValue createErrorValueForMessages(com.vmware.vapi.data.ErrorDefinition errorDef, java.util.List<com.vmware.vapi.Message> messages)
Message
s.errorDef
- error definitionmessages
- the messages for the new ErrorValue
ErrorValue
instancejava.lang.IllegalArgumentException
- if messages
or errorDef
is null
or messages
is empty or contains
null
element(s)public static java.util.List<com.vmware.vapi.Message> getMessagesFromErrorValue(StructValue error)
ErrorValue
represented as list of Message
s. This
method assumes the structure of "messages" field from
createErrorValueForMessages(ErrorDefinition, List)
. In case this
structure is not present - empty list is returned.error
- standard error valueMessage
instances