public class SimpleAttributeDefinition extends AttributeDefinition
Resource
or a
parameter or reply value type field in an OperationDefinition
, with utility
methods for conversion to and from xml and for validation.attributeMarshaller, COMPLEX_TYPES
Modifier | Constructor and Description |
---|---|
protected |
SimpleAttributeDefinition(AbstractAttributeDefinitionBuilder<?,? extends SimpleAttributeDefinition> builder) |
|
SimpleAttributeDefinition(String name,
org.jboss.dmr.ModelNode defaultValue,
org.jboss.dmr.ModelType type,
boolean allowNull)
Creates a new attribute definition.
|
|
SimpleAttributeDefinition(String name,
org.jboss.dmr.ModelNode defaultValue,
org.jboss.dmr.ModelType type,
boolean allowNull,
AttributeAccess.Flag... flags)
Creates a new attribute definition.
|
|
SimpleAttributeDefinition(String name,
org.jboss.dmr.ModelNode defaultValue,
org.jboss.dmr.ModelType type,
boolean allowNull,
MeasurementUnit measurementUnit)
Deprecated.
|
|
SimpleAttributeDefinition(String name,
org.jboss.dmr.ModelNode defaultValue,
org.jboss.dmr.ModelType type,
boolean allowNull,
MeasurementUnit measurementUnit,
AttributeAccess.Flag... flags)
Deprecated.
|
|
SimpleAttributeDefinition(String name,
org.jboss.dmr.ModelNode defaultValue,
org.jboss.dmr.ModelType type,
boolean allowNull,
String[] alternatives)
Deprecated.
|
|
SimpleAttributeDefinition(String name,
org.jboss.dmr.ModelType type,
boolean allowNull)
Creates a new attribute definition.
|
|
SimpleAttributeDefinition(String name,
org.jboss.dmr.ModelType type,
boolean allowNull,
AttributeAccess.Flag... flags)
Creates a new attribute definition.
|
|
SimpleAttributeDefinition(String name,
org.jboss.dmr.ModelType type,
boolean allowNull,
MeasurementUnit measurementUnit)
Creates a new attribute definition.
|
|
SimpleAttributeDefinition(String name,
org.jboss.dmr.ModelType type,
boolean allowNull,
MeasurementUnit measurementUnit,
AttributeAccess.Flag... flags)
Creates a new attribute definition.
|
|
SimpleAttributeDefinition(String name,
org.jboss.dmr.ModelType type,
boolean allowNull,
ParameterCorrector corrector,
ParameterValidator validator)
Deprecated.
|
|
SimpleAttributeDefinition(String name,
String xmlName,
org.jboss.dmr.ModelNode defaultValue,
org.jboss.dmr.ModelType type,
boolean allowNull,
boolean allowExpression,
MeasurementUnit measurementUnit)
Deprecated.
|
|
SimpleAttributeDefinition(String name,
String xmlName,
org.jboss.dmr.ModelNode defaultValue,
org.jboss.dmr.ModelType type,
boolean allowNull,
boolean allowExpression,
MeasurementUnit measurementUnit,
AttributeAccess.Flag... flags)
Deprecated.
|
|
SimpleAttributeDefinition(String name,
String xmlName,
org.jboss.dmr.ModelNode defaultValue,
org.jboss.dmr.ModelType type,
boolean allowNull,
boolean allowExpression,
MeasurementUnit measurementUnit,
ParameterCorrector corrector,
ParameterValidator validator,
boolean validateNull,
String[] alternatives,
String[] requires,
AttributeAccess.Flag... flags)
Deprecated.
|
|
SimpleAttributeDefinition(String name,
String xmlName,
org.jboss.dmr.ModelNode defaultValue,
org.jboss.dmr.ModelType type,
boolean allowNull,
boolean allowExpression,
MeasurementUnit measurementUnit,
ParameterCorrector corrector,
ParameterValidator validator,
boolean validateNull,
String[] alternatives,
String[] requires,
AttributeMarshaller attributeMarshaller,
boolean resourceOnly,
DeprecationData deprecated,
AccessConstraintDefinition[] accessConstraints,
AttributeAccess.Flag... flags)
Deprecated.
|
|
SimpleAttributeDefinition(String name,
String xmlName,
org.jboss.dmr.ModelNode defaultValue,
org.jboss.dmr.ModelType type,
boolean allowNull,
boolean allowExpression,
MeasurementUnit measurementUnit,
ParameterCorrector corrector,
ParameterValidator validator,
boolean validateNull,
String[] alternatives,
String[] requires,
AttributeMarshaller attributeMarshaller,
boolean resourceOnly,
DeprecationData deprecated,
AccessConstraintDefinition[] accessConstraints,
Boolean nullSignificant,
AttributeAccess.Flag... flags)
Deprecated.
|
protected |
SimpleAttributeDefinition(String name,
String xmlName,
org.jboss.dmr.ModelNode defaultValue,
org.jboss.dmr.ModelType type,
boolean allowNull,
boolean allowExpression,
MeasurementUnit measurementUnit,
ParameterCorrector corrector,
ParameterValidator validator,
boolean validateNull,
String[] alternatives,
String[] requires,
AttributeMarshaller attributeMarshaller,
boolean resourceOnly,
DeprecationData deprecated,
AccessConstraintDefinition[] accessConstraints,
Boolean nullSignificant,
AttributeParser parser,
AttributeAccess.Flag... flags)
Deprecated.
|
|
SimpleAttributeDefinition(String name,
String xmlName,
org.jboss.dmr.ModelNode defaultValue,
org.jboss.dmr.ModelType type,
boolean allowNull,
boolean allowExpression,
MeasurementUnit measurementUnit,
ParameterCorrector corrector,
ParameterValidator validator,
boolean validateNull,
String[] alternatives,
String[] requires,
AttributeMarshaller attributeMarshaller,
boolean resourceOnly,
DeprecationData deprecated,
AttributeAccess.Flag... flags)
Deprecated.
|
|
SimpleAttributeDefinition(String name,
String xmlName,
org.jboss.dmr.ModelNode defaultValue,
org.jboss.dmr.ModelType type,
boolean allowNull,
boolean allowExpression,
MeasurementUnit measurementUnit,
ParameterValidator validator)
Deprecated.
|
|
SimpleAttributeDefinition(String name,
String xmlName,
org.jboss.dmr.ModelNode defaultValue,
org.jboss.dmr.ModelType type,
boolean allowNull,
boolean allowExpression,
MeasurementUnit measurementUnit,
ParameterValidator validator,
String[] alternatives,
String[] requires,
AttributeAccess.Flag... flags)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
marshallAsAttribute(org.jboss.dmr.ModelNode resourceModel,
boolean marshallDefault,
XMLStreamWriter writer)
Marshalls the value from the given
resourceModel as an xml attribute, if it
is marshallable . |
void |
marshallAsAttribute(org.jboss.dmr.ModelNode resourceModel,
XMLStreamWriter writer)
Marshalls the value from the given
resourceModel as an xml attribute, if it
is marshallable . |
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 validator . |
void |
parseAndSetParameter(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 validator , and then stores it in the given operation
model node as a key/value pair whose key is this attribute's name . |
addAccessConstraints, addAllowedValuesToDescription, addDeprecatedInfo, addOperationParameterDescription, addOperationParameterDescription, addResourceAttributeDescription, addResourceAttributeDescription, convertParameterExpressions, convertStringExpression, correctValue, getAccessConstraints, getAlternatives, getAttributeDeprecatedDescription, getAttributeMarshaller, getAttributeTextDescription, getCorrector, getDefaultValue, getDeprecationData, getFlags, getMeasurementUnit, getName, getNoTextDescription, getParser, getRequires, getType, getValidator, getXmlName, hasAlternative, isAllowed, isAllowExpression, isAllowNull, isDeprecated, isMarshallable, isMarshallable, isNullSignificant, isRequired, isResourceOnly, isValidatingNull, marshallAsElement, resolveModelAttribute, resolveModelAttribute, resolveValue, resolveValue, validateAndSet, validateOperation
public SimpleAttributeDefinition(String name, org.jboss.dmr.ModelType type, boolean allowNull)
name
- the name of the attribute. Cannot be null
type
- the type of the attribute value. Cannot be null
allowNull
- true
if ModelType.UNDEFINED
is a valid type for the valuepublic SimpleAttributeDefinition(String name, org.jboss.dmr.ModelType type, boolean allowNull, AttributeAccess.Flag... flags)
name
- the name of the attribute. Cannot be null
type
- the type of the attribute value. Cannot be null
allowNull
- true
if ModelType.UNDEFINED
is a valid type for the valueflags
- any flags to indicate special characteristics of the attributepublic SimpleAttributeDefinition(String name, org.jboss.dmr.ModelType type, boolean allowNull, MeasurementUnit measurementUnit)
name
- the name of the attribute. Cannot be null
type
- the type of the attribute value. Cannot be null
allowNull
- true
if ModelType.UNDEFINED
is a valid type for the valuemeasurementUnit
- a measurement unit for the attribute's value. Can be null
public SimpleAttributeDefinition(String name, org.jboss.dmr.ModelType type, boolean allowNull, MeasurementUnit measurementUnit, AttributeAccess.Flag... flags)
name
- the name of the attribute. Cannot be null
type
- the type of the attribute value. Cannot be null
allowNull
- true
if ModelType.UNDEFINED
is a valid type for the valuemeasurementUnit
- a measurement unit for the attribute's value. Can be null
flags
- any flags to indicate special characteristics of the attributepublic SimpleAttributeDefinition(String name, org.jboss.dmr.ModelNode defaultValue, org.jboss.dmr.ModelType type, boolean allowNull)
name
- the name of the attribute. Cannot be null
defaultValue
- a default value to use for the attribute if none is specified by the user. Can be null
type
- the type of the attribute value. Cannot be null
allowNull
- true
if ModelType.UNDEFINED
is a valid type for the valuepublic SimpleAttributeDefinition(String name, org.jboss.dmr.ModelNode defaultValue, org.jboss.dmr.ModelType type, boolean allowNull, AttributeAccess.Flag... flags)
name
- the name of the attribute. Cannot be null
defaultValue
- a default value to use for the attribute if none is specified by the user. Can be null
type
- the type of the attribute value. Cannot be null
allowNull
- true
if ModelType.UNDEFINED
is a valid type for the valueflags
- any flags to indicate special characteristics of the attribute@Deprecated public SimpleAttributeDefinition(String name, org.jboss.dmr.ModelNode defaultValue, org.jboss.dmr.ModelType type, boolean allowNull, MeasurementUnit measurementUnit)
SimpleAttributeDefinitionBuilder
@Deprecated public SimpleAttributeDefinition(String name, org.jboss.dmr.ModelNode defaultValue, org.jboss.dmr.ModelType type, boolean allowNull, MeasurementUnit measurementUnit, AttributeAccess.Flag... flags)
SimpleAttributeDefinitionBuilder
@Deprecated public SimpleAttributeDefinition(String name, String xmlName, org.jboss.dmr.ModelNode defaultValue, org.jboss.dmr.ModelType type, boolean allowNull, boolean allowExpression, MeasurementUnit measurementUnit)
SimpleAttributeDefinitionBuilder
@Deprecated public SimpleAttributeDefinition(String name, String xmlName, org.jboss.dmr.ModelNode defaultValue, org.jboss.dmr.ModelType type, boolean allowNull, boolean allowExpression, MeasurementUnit measurementUnit, AttributeAccess.Flag... flags)
SimpleAttributeDefinitionBuilder
@Deprecated public SimpleAttributeDefinition(String name, String xmlName, org.jboss.dmr.ModelNode defaultValue, org.jboss.dmr.ModelType type, boolean allowNull, boolean allowExpression, MeasurementUnit measurementUnit, ParameterValidator validator)
SimpleAttributeDefinitionBuilder
@Deprecated public SimpleAttributeDefinition(String name, String xmlName, org.jboss.dmr.ModelNode defaultValue, org.jboss.dmr.ModelType type, boolean allowNull, boolean allowExpression, MeasurementUnit measurementUnit, ParameterValidator validator, String[] alternatives, String[] requires, AttributeAccess.Flag... flags)
SimpleAttributeDefinitionBuilder
@Deprecated public SimpleAttributeDefinition(String name, String xmlName, org.jboss.dmr.ModelNode defaultValue, org.jboss.dmr.ModelType type, boolean allowNull, boolean allowExpression, MeasurementUnit measurementUnit, ParameterCorrector corrector, ParameterValidator validator, boolean validateNull, String[] alternatives, String[] requires, AttributeAccess.Flag... flags)
SimpleAttributeDefinitionBuilder
@Deprecated public SimpleAttributeDefinition(String name, String xmlName, org.jboss.dmr.ModelNode defaultValue, org.jboss.dmr.ModelType type, boolean allowNull, boolean allowExpression, MeasurementUnit measurementUnit, ParameterCorrector corrector, ParameterValidator validator, boolean validateNull, String[] alternatives, String[] requires, AttributeMarshaller attributeMarshaller, boolean resourceOnly, DeprecationData deprecated, AttributeAccess.Flag... flags)
SimpleAttributeDefinitionBuilder
@Deprecated public SimpleAttributeDefinition(String name, String xmlName, org.jboss.dmr.ModelNode defaultValue, org.jboss.dmr.ModelType type, boolean allowNull, boolean allowExpression, MeasurementUnit measurementUnit, ParameterCorrector corrector, ParameterValidator validator, boolean validateNull, String[] alternatives, String[] requires, AttributeMarshaller attributeMarshaller, boolean resourceOnly, DeprecationData deprecated, AccessConstraintDefinition[] accessConstraints, AttributeAccess.Flag... flags)
SimpleAttributeDefinitionBuilder
@Deprecated public SimpleAttributeDefinition(String name, org.jboss.dmr.ModelNode defaultValue, org.jboss.dmr.ModelType type, boolean allowNull, String[] alternatives)
SimpleAttributeDefinitionBuilder
@Deprecated public SimpleAttributeDefinition(String name, org.jboss.dmr.ModelType type, boolean allowNull, ParameterCorrector corrector, ParameterValidator validator)
SimpleAttributeDefinitionBuilder
@Deprecated public SimpleAttributeDefinition(String name, String xmlName, org.jboss.dmr.ModelNode defaultValue, org.jboss.dmr.ModelType type, boolean allowNull, boolean allowExpression, MeasurementUnit measurementUnit, ParameterCorrector corrector, ParameterValidator validator, boolean validateNull, String[] alternatives, String[] requires, AttributeMarshaller attributeMarshaller, boolean resourceOnly, DeprecationData deprecated, AccessConstraintDefinition[] accessConstraints, Boolean nullSignificant, AttributeAccess.Flag... flags)
SimpleAttributeDefinitionBuilder
@Deprecated protected SimpleAttributeDefinition(String name, String xmlName, org.jboss.dmr.ModelNode defaultValue, org.jboss.dmr.ModelType type, boolean allowNull, boolean allowExpression, MeasurementUnit measurementUnit, ParameterCorrector corrector, ParameterValidator validator, boolean validateNull, String[] alternatives, String[] requires, AttributeMarshaller attributeMarshaller, boolean resourceOnly, DeprecationData deprecated, AccessConstraintDefinition[] accessConstraints, Boolean nullSignificant, AttributeParser parser, AttributeAccess.Flag... flags)
SimpleAttributeDefinitionBuilder
protected SimpleAttributeDefinition(AbstractAttributeDefinitionBuilder<?,? extends SimpleAttributeDefinition> builder)
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 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 validparseAndSetParameter(String, ModelNode, XMLStreamReader)
public void parseAndSetParameter(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 validator
, and then stores it in the given operation
model node as 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 void marshallAsAttribute(org.jboss.dmr.ModelNode resourceModel, XMLStreamWriter writer) throws XMLStreamException
resourceModel
as an xml attribute, if it
is marshallable
.
Invoking this method is the same as calling marshallAsAttribute(resourceModel, true, writer)
resourceModel
- the model, a non-null node of ModelType.OBJECT
.writer
- stream writer to use for writing the attributeXMLStreamException
- if writer
throws an exceptionpublic void marshallAsAttribute(org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException
resourceModel
as an xml attribute, if it
is marshallable
.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 writer
throws an exceptionpublic void marshallAsElement(org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException
resourceModel
as an xml element, if it
is marshallable
.
This implementation marshalls the attribute value as text content of the element.marshallAsElement
in class AttributeDefinition
resourceModel
- the model, a non-null node of ModelType.OBJECT
.writer
- stream writer to use for writing the attributeXMLStreamException
- if thrown by writer
Copyright © 2014 JBoss by Red Hat. All rights reserved.