public class ObjectTypeAttributeDefinition extends SimpleAttributeDefinition
AttributeDefinition
for attributes of type ModelType.OBJECT
that aren't simple maps, but
rather a set fixed keys where each key may be associated with a value of a different type.MapAttributeDefinition
Modifier and Type | Class and Description |
---|---|
static class |
ObjectTypeAttributeDefinition.Builder |
AttributeDefinition.NameAndGroup
attributeMarshaller, COMPLEX_TYPES, referenceRecorder
Modifier | Constructor and Description |
---|---|
protected |
ObjectTypeAttributeDefinition(AbstractAttributeDefinitionBuilder<?,? extends ObjectTypeAttributeDefinition> builder,
String suffix,
AttributeDefinition[] valueTypes) |
protected |
ObjectTypeAttributeDefinition(ObjectTypeAttributeDefinition.Builder builder) |
Modifier and Type | Method and Description |
---|---|
protected void |
addAllowedValuesToDescription(org.jboss.dmr.ModelNode result,
ParameterValidator validator)
Adds the allowed values.
|
void |
addCapabilityRequirements(OperationContext context,
org.jboss.dmr.ModelNode attributeValue)
Based on the given attribute value, add capability requirements.
|
org.jboss.dmr.ModelNode |
addOperationParameterDescription(org.jboss.dmr.ModelNode resourceDescription,
String operationName,
ResourceDescriptionResolver resolver,
Locale locale,
ResourceBundle bundle)
Creates a returns a basic model node describing a parameter that sets this attribute, after attaching it to the
given overall operation description model node.
|
org.jboss.dmr.ModelNode |
addOperationParameterDescription(ResourceBundle bundle,
String prefix,
org.jboss.dmr.ModelNode operationDescription)
Creates a returns a basic model node describing a parameter that sets this attribute, after attaching it to the
given overall operation description model node.
|
org.jboss.dmr.ModelNode |
addResourceAttributeDescription(org.jboss.dmr.ModelNode resourceDescription,
ResourceDescriptionResolver resolver,
Locale locale,
ResourceBundle bundle)
Creates a returns a basic model node describing the attribute, after attaching it to the given overall resource
description model node.
|
org.jboss.dmr.ModelNode |
addResourceAttributeDescription(ResourceBundle bundle,
String prefix,
org.jboss.dmr.ModelNode resourceDescription)
Creates a returns a basic model node describing the attribute, after attaching it to the given overall resource
description model node.
|
protected void |
addValueTypeDescription(org.jboss.dmr.ModelNode node,
String prefix,
ResourceBundle bundle,
boolean forOperation,
ResourceDescriptionResolver resolver,
Locale locale) |
protected void |
addValueTypeDescription(org.jboss.dmr.ModelNode node,
String prefix,
ResourceBundle bundle,
ResourceDescriptionResolver resolver,
Locale locale)
Deprecated.
use #addValueTypeDescription(ModelNode, String, ResourceBundle, boolean, ResourceDescriptionResolver, Locale)
|
protected org.jboss.dmr.ModelNode |
convertParameterExpressions(org.jboss.dmr.ModelNode parameter)
Examine the given operation parameter value for any expression syntax, converting the relevant node to
ModelType.EXPRESSION if such is supported. |
org.jboss.dmr.ModelNode |
parse(String value,
XMLStreamReader reader)
Creates and returns a
ModelNode using the given value after first validating the node
against this object's validator . |
void |
removeCapabilityRequirements(OperationContext context,
org.jboss.dmr.ModelNode attributeValue)
Based on the given attribute value, remove capability requirements.
|
org.jboss.dmr.ModelNode |
resolveValue(ExpressionResolver resolver,
org.jboss.dmr.ModelNode value)
Overrides the superclass implementation to allow the AttributeDefinition for each field in the
object to in turn resolve that field.
|
marshallAsAttribute, marshallAsAttribute, marshallAsElement, parseAndSetParameter
addAccessConstraints, addDeprecatedInfo, convertStringExpression, correctValue, getAccessConstraints, getAllowedValues, getAlternatives, getArbitraryDescriptors, getAttributeDeprecatedDescription, getAttributeGroup, getAttributeMarshaller, getAttributeTextDescription, getCorrector, getDefaultValue, getDeprecationData, getFlags, getMeasurementUnit, getName, getNoTextDescription, getParser, getReferenceRecorder, getRequires, getType, getUndefinedMetricValue, getValidator, getXmlName, hasAlternative, hasCapabilityRequirements, isAllowed, isAllowExpression, isAllowNull, isDeprecated, isMarshallable, isMarshallable, isNullSignificant, isRequired, isResourceOnly, isValidatingNull, marshallAsElement, resolveModelAttribute, resolveModelAttribute, resolveValue, validateAndSet, validateOperation
protected ObjectTypeAttributeDefinition(ObjectTypeAttributeDefinition.Builder builder)
protected ObjectTypeAttributeDefinition(AbstractAttributeDefinitionBuilder<?,? extends ObjectTypeAttributeDefinition> builder, String suffix, AttributeDefinition[] valueTypes)
protected org.jboss.dmr.ModelNode convertParameterExpressions(org.jboss.dmr.ModelNode parameter)
AttributeDefinition
ModelType.EXPRESSION
if such is supported.
This implementation checks if expressions are allowed
and if so, calls
AttributeDefinition.convertStringExpression(ModelNode)
to convert a ModelType.STRING
to a ModelType.EXPRESSION
.
No other conversions are performed. For use cases requiring more complex behavior, a subclass that overrides
this method should be used.
If expressions are supported this implementation also checks if the attribute type
is one of
the complex DMR types
. If it is, an IllegalStateException
is thrown, as this
implementation cannot properly handle such a combination, and a subclass that overrides this method should be used.
convertParameterExpressions
in class AttributeDefinition
parameter
- the node to examine. Cannot not be null
parameter
but with expressions converted, or the original parameter if no
conversion was performed. Will not return null
public org.jboss.dmr.ModelNode parse(String value, XMLStreamReader reader) throws XMLStreamException
SimpleAttributeDefinition
ModelNode
using the given value
after first validating the node
against this object's validator
.
If value
is null
an undefined
node will be returned.
parse
in class SimpleAttributeDefinition
value
- the value. Will be trimmed
before use if not null
.reader
- XMLStreamReader
from which the location
from which
the attribute value was read can be obtained and used in any XMLStreamException
, in case
the given value is invalid.ModelNode
representing the parsed valueXMLStreamException
- if value
is not validSimpleAttributeDefinition.parseAndSetParameter(String, ModelNode, XMLStreamReader)
public void addCapabilityRequirements(OperationContext context, org.jboss.dmr.ModelNode attributeValue)
AttributeDefinition
This is a no-op in this base class. Subclasses that support attribute types that can represent capability references should override this method.
addCapabilityRequirements
in class AttributeDefinition
context
- the operation contextattributeValue
- the value of the attribute described by this objectpublic void removeCapabilityRequirements(OperationContext context, org.jboss.dmr.ModelNode attributeValue)
AttributeDefinition
This is a no-op in this base class. Subclasses that support attribute types that can represent capability references should override this method.
removeCapabilityRequirements
in class AttributeDefinition
context
- the operation contextattributeValue
- the value of the attribute described by this objectpublic org.jboss.dmr.ModelNode addResourceAttributeDescription(ResourceBundle bundle, String prefix, org.jboss.dmr.ModelNode resourceDescription)
AttributeDefinition
addResourceAttributeDescription
in class AttributeDefinition
bundle
- resource bundle to use for text descriptionsprefix
- prefix to prepend to the attribute name key when looking up descriptionsresourceDescription
- the overall resource descriptionpublic org.jboss.dmr.ModelNode addOperationParameterDescription(org.jboss.dmr.ModelNode resourceDescription, String operationName, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)
AttributeDefinition
addOperationParameterDescription
in class AttributeDefinition
resourceDescription
- the overall resource descriptionoperationName
- the operation nameresolver
- provider of localized text descriptionslocale
- locale to pass to the resolverbundle
- bundle to pass to the resolverpublic org.jboss.dmr.ModelNode addResourceAttributeDescription(org.jboss.dmr.ModelNode resourceDescription, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)
AttributeDefinition
addResourceAttributeDescription
in class AttributeDefinition
resourceDescription
- the overall resource descriptionresolver
- provider of localized text descriptionslocale
- locale to pass to the resolverbundle
- bundle to pass to the resolverpublic org.jboss.dmr.ModelNode addOperationParameterDescription(ResourceBundle bundle, String prefix, org.jboss.dmr.ModelNode operationDescription)
AttributeDefinition
addOperationParameterDescription
in class AttributeDefinition
bundle
- resource bundle to use for text descriptionsprefix
- prefix to prepend to the attribute name key when looking up descriptionsoperationDescription
- the overall resource descriptionpublic org.jboss.dmr.ModelNode resolveValue(ExpressionResolver resolver, org.jboss.dmr.ModelNode value) throws OperationFailedException
value
, resolves it using the given resolver
and validates it using this attribute's validator
. If the value is
undefined and a default value
is available, the default value is used.resolveValue
in class AttributeDefinition
resolver
- the expression resolvervalue
- a node that is expected to be a valid value for an attribute defined by this definitionvalue
is not definedOperationFailedException
- if the value is not valid@Deprecated protected void addValueTypeDescription(org.jboss.dmr.ModelNode node, String prefix, ResourceBundle bundle, ResourceDescriptionResolver resolver, Locale locale)
protected void addValueTypeDescription(org.jboss.dmr.ModelNode node, String prefix, ResourceBundle bundle, boolean forOperation, ResourceDescriptionResolver resolver, Locale locale)
protected void addAllowedValuesToDescription(org.jboss.dmr.ModelNode result, ParameterValidator validator)
AttributeDefinition
addAllowedValuesToDescription
in class AttributeDefinition
result
- the node to add the allowed values tovalidator
- the validator to get the allowed values fromCopyright © 2023 JBoss by Red Hat. All rights reserved.