| Modifier and Type | Field and Description |
|---|---|
static String |
ALREADY_EXISTS |
static String |
ARGS_FIELD_NAME |
static String |
DATA_FIELD_NAME |
static String |
DEFAUL_MSG_FIELD_NAME |
static String |
ID_FIELD_NAME |
static String |
INTERNAL_SERVER_ERROR |
static String |
INVALID_ARGUMENT |
static String |
MESSAGE_STRUCT_NAME |
static String |
MESSAGES_FIELD_NAME |
static String |
NOT_FOUND |
static String |
OPERATION_NOT_FOUND |
static Map<String,com.vmware.vapi.data.DataDefinition> |
STANDARD_ERROR_FIELDS |
static String |
UNAUTHENTICATED |
static String |
UNEXPECTED_INPUT |
| Constructor and Description |
|---|
StandardDataFactory() |
| Modifier and Type | Method and Description |
|---|---|
static ErrorValue |
createErrorValueForMessages(com.vmware.vapi.data.ErrorDefinition errorDef,
List<com.vmware.vapi.Message> messages)
Creates instance for given error definition and list of
Messagess. |
static ErrorValue |
createErrorValueForMessages(String errorName,
List<com.vmware.vapi.Message> messages)
Creates a standard error
ErrorValue for the given
name list of Messagess. |
static com.vmware.vapi.data.ErrorDefinition |
createStandardErrorDefinition(String errorName)
Factory method for
ErrorDefinitions for standard
vAPI errors. |
static com.vmware.vapi.data.StructDefinition |
getLocalizableMessageDefinition() |
static List<com.vmware.vapi.Message> |
getMessagesFromErrorValue(StructValue error)
Returns messages associated with the specified standard error
ErrorValue represented as list of Messages. |
public static final String ALREADY_EXISTS
public static final String INTERNAL_SERVER_ERROR
public static final String OPERATION_NOT_FOUND
public static final String INVALID_ARGUMENT
public static final String NOT_FOUND
public static final String UNAUTHENTICATED
public static final String UNEXPECTED_INPUT
public static final String MESSAGE_STRUCT_NAME
public static final String ID_FIELD_NAME
public static final String DEFAUL_MSG_FIELD_NAME
public static final String ARGS_FIELD_NAME
public static final String MESSAGES_FIELD_NAME
public static final String DATA_FIELD_NAME
public static com.vmware.vapi.data.StructDefinition getLocalizableMessageDefinition()
public static com.vmware.vapi.data.ErrorDefinition createStandardErrorDefinition(String errorName)
ErrorDefinitions for standard
vAPI errors.
Creates instance for the specified name. The name is used as name
of the StructDefinition represented by the instance.
Additionally, a field named "messages" is added to the
StructDefinition, the definition of this field is:
ListDefinition
StructDefinition
id -> StringDefinition
default_message -> StringDefinition
args -> ListDefinition
StringDefinition
That is a list of localizable messages.errorName - the error nameErrorDefinition isntancepublic static ErrorValue createErrorValueForMessages(String errorName, List<com.vmware.vapi.Message> messages)
ErrorValue for the given
name list of Messagess.public static ErrorValue createErrorValueForMessages(com.vmware.vapi.data.ErrorDefinition errorDef, List<com.vmware.vapi.Message> messages)
Messagess. The name is used as name of the
StructValue represented by the instance. Messages are
converted to list of structures and set as "messages" field (of
StructValue) of this instance. The structure of the
"messages" field is:
ListValue
StructValue
id -> StringValue
default_message -> StringValue
args -> ListValue
StringValue
errorDef - error definitionmessages - the messages for the new ErrorValueErrirValue instanceIllegalArgumentException - if messages or
errorDef is null or
messages is empty or contains null
element(s)public static List<com.vmware.vapi.Message> getMessagesFromErrorValue(StructValue error)
ErrorValue represented as list of Messages.
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 valueCopyright © 2016. All Rights Reserved.