public abstract class ListAttributeDefinition extends AttributeDefinition
ModelType.LIST
attribute in a Resource
, with utility
methods for conversion to and from xml and for validation.Modifier and Type | Class and Description |
---|---|
static class |
ListAttributeDefinition.Builder<BUILDER extends ListAttributeDefinition.Builder,ATTRIBUTE extends ListAttributeDefinition> |
AttributeDefinition.NameAndGroup
attributeMarshaller, COMPLEX_TYPES, referenceRecorder
Modifier | Constructor and Description |
---|---|
protected |
ListAttributeDefinition(ListAttributeDefinition.Builder<?,?> builder) |
|
ListAttributeDefinition(String name,
boolean allowNull,
ParameterValidator elementValidator)
Deprecated.
|
|
ListAttributeDefinition(String name,
boolean allowNull,
ParameterValidator elementValidator,
AttributeAccess.Flag... flags)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
addAttributeValueTypeDescription(org.jboss.dmr.ModelNode node,
ResourceDescriptionResolver resolver,
Locale locale,
ResourceBundle bundle) |
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.
|
protected abstract void |
addOperationParameterValueTypeDescription(org.jboss.dmr.ModelNode node,
String operationName,
ResourceDescriptionResolver resolver,
Locale locale,
ResourceBundle bundle) |
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 abstract void |
addValueTypeDescription(org.jboss.dmr.ModelNode node,
ResourceBundle bundle) |
protected org.jboss.dmr.ModelNode |
convertParameterElementExpressions(org.jboss.dmr.ModelNode parameterElement)
Examine the given element of a parameter list for any expression syntax, converting the relevant node to
ModelType.EXPRESSION if such is supported. |
protected org.jboss.dmr.ModelNode |
convertParameterExpressions(org.jboss.dmr.ModelNode parameter)
Iterates through the elements in the
parameter list, calling convertParameterElementExpressions(ModelNode)
for each. |
ParameterValidator |
getElementValidator()
The validator used to validate elements in the list.
|
void |
marshallAsElement(org.jboss.dmr.ModelNode resourceModel,
boolean marshallDefault,
XMLStreamWriter writer)
Marshalls the value from the given
resourceModel as an xml element, if it
is marshallable . |
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 element validator . |
void |
parseAndAddParameterElement(String value,
org.jboss.dmr.ModelNode operation,
XMLStreamReader reader)
Creates a
ModelNode using the given value after first validating the node
against this object's element validator , and then stores it in the given operation
model node as an element in a ModelType.LIST value in a key/value pair whose key is this attribute's
name . |
void |
parseAndSetParameter(String value,
org.jboss.dmr.ModelNode operation,
XMLStreamReader reader)
Deprecated.
in favour of using
attribute parser |
addAccessConstraints, addAllowedValuesToDescription, addCapabilityRequirements, 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, removeCapabilityRequirements, resolveModelAttribute, resolveModelAttribute, resolveValue, resolveValue, validateAndSet, validateOperation
@Deprecated public ListAttributeDefinition(String name, boolean allowNull, ParameterValidator elementValidator)
@Deprecated public ListAttributeDefinition(String name, boolean allowNull, ParameterValidator elementValidator, AttributeAccess.Flag... flags)
protected ListAttributeDefinition(ListAttributeDefinition.Builder<?,?> builder)
public ParameterValidator getElementValidator()
public org.jboss.dmr.ModelNode parse(String value, XMLStreamReader reader) throws XMLStreamException
ModelNode
using the given value
after first validating the node
against this object's element validator
.
If value
is null
an undefined
node will be returned.
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 validparseAndAddParameterElement(String, ModelNode, XMLStreamReader)
public void parseAndAddParameterElement(String value, org.jboss.dmr.ModelNode operation, XMLStreamReader reader) throws XMLStreamException
ModelNode
using the given value
after first validating the node
against this object's element validator
, and then stores it in the given operation
model node as an element in a ModelType.LIST
value in a key/value pair whose key is this attribute's
name
.
If value
is null
an undefined
node will be stored if such a value
is acceptable to the validator.
The expected usage of this method is in parsers seeking to build up an operation to store their parsed data into the configuration.
value
- the value. Will be trimmed
before use if not null
.operation
- model node of type ModelType.OBJECT
into which the parsed value should be storedreader
- 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.XMLStreamException
- if value
is not validpublic 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 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(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 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 descriptionprotected abstract void addValueTypeDescription(org.jboss.dmr.ModelNode node, ResourceBundle bundle)
protected abstract void addAttributeValueTypeDescription(org.jboss.dmr.ModelNode node, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)
protected abstract void addOperationParameterValueTypeDescription(org.jboss.dmr.ModelNode node, String operationName, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle)
public void marshallAsElement(org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException
AttributeDefinition
resourceModel
as an xml element, if it
is marshallable
.marshallAsElement
in class AttributeDefinition
resourceModel
- the model, a non-null node of ModelType.OBJECT
.marshallDefault
- true
if the value should be marshalled even if it matches the default valuewriter
- stream writer to use for writing the attributeXMLStreamException
- if thrown by writer
protected org.jboss.dmr.ModelNode convertParameterExpressions(org.jboss.dmr.ModelNode parameter)
parameter
list, calling convertParameterElementExpressions(ModelNode)
for each.
Note that the default implementation of convertParameterElementExpressions(ModelNode)
will only convert simple ModelType.STRING
elements. If users need to handle complex elements
with embedded expressions, they should use a subclass that overrides that method.
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
protected org.jboss.dmr.ModelNode convertParameterElementExpressions(org.jboss.dmr.ModelNode parameterElement)
ModelType.EXPRESSION
if such is supported. This implementation will only convert elements of
ModelType.STRING
. Subclasses that need to handle complex elements should override this method.parameterElement
- the node to examine. Will not be null
null
@Deprecated public void parseAndSetParameter(String value, org.jboss.dmr.ModelNode operation, XMLStreamReader reader) throws XMLStreamException
attribute parser
value
- String with "," separated string elementsoperation
- operation to with this list elements are addedreader
- xml reader from where reading is be doneXMLStreamException
Copyright © 2023 JBoss by Red Hat. All rights reserved.