Package org.jboss.as.controller
Class SimpleAttributeDefinition
- java.lang.Object
-
- org.jboss.as.controller.AttributeDefinition
-
- org.jboss.as.controller.SimpleAttributeDefinition
-
- Direct Known Subclasses:
ObjectTypeAttributeDefinition
public class SimpleAttributeDefinition extends AttributeDefinition
Defining characteristics of an attribute in aResource
or a parameter or reply value type field in anOperationDefinition
, with utility methods for conversion to and from xml and for validation.- Author:
- Brian Stansberry (c) 2011 Red Hat Inc.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jboss.as.controller.AttributeDefinition
AttributeDefinition.NameAndGroup
-
-
Field Summary
-
Fields inherited from class org.jboss.as.controller.AttributeDefinition
attributeMarshaller, COMPLEX_TYPES, referenceRecorder
-
-
Constructor Summary
Constructors Modifier Constructor Description SimpleAttributeDefinition(String name, org.jboss.dmr.ModelType type, boolean allowNull)
Deprecated.protected
SimpleAttributeDefinition(AbstractAttributeDefinitionBuilder<?,? extends SimpleAttributeDefinition> builder)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
marshallAsAttribute(org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer)
Marshalls the value from the givenresourceModel
as an xml attribute, if itis marshallable
.void
marshallAsAttribute(org.jboss.dmr.ModelNode resourceModel, XMLStreamWriter writer)
Marshalls the value from the givenresourceModel
as an xml attribute, if itis marshallable
.void
marshallAsElement(org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer)
Deprecated.org.jboss.dmr.ModelNode
parse(String value, XMLStreamReader reader)
Deprecated.void
parseAndSetParameter(String value, org.jboss.dmr.ModelNode operation, XMLStreamReader reader)
Creates aModelNode
using the givenvalue
after first validating the node againstthis object's validator
, and then stores it in the givenoperation
model node as a key/value pair whose key is this attribute'sname
.-
Methods inherited from class org.jboss.as.controller.AttributeDefinition
addAccessConstraints, addAllowedValuesToDescription, addCapabilityRequirements, addCapabilityRequirements, addDeprecatedInfo, addOperationParameterDescription, addOperationParameterDescription, addOperationReplyDescription, addOperationReplyDescription, addResourceAttributeDescription, addResourceAttributeDescription, convertParameterExpressions, convertStringExpression, correctValue, getAccessConstraints, getAllowedValues, getAlternatives, getArbitraryDescriptors, getAttributeDeprecatedDescription, getAttributeGroup, getAttributeMarshaller, getAttributeTextDescription, getCorrector, getDefaultValue, getDeprecationData, getFlags, getMarshaller, getMeasurementUnit, getName, getNoTextDescription, getParser, getReferenceRecorder, getRequires, getType, getUndefinedMetricValue, getValidator, getXmlName, hasAlternative, hasCapabilityRequirements, isAllowed, isAllowExpression, isAllowNull, isDeprecated, isMarshallable, isMarshallable, isNillable, isNullSignificant, isRequired, isRequired, isResourceOnly, isValidatingNull, marshallAsElement, removeCapabilityRequirements, removeCapabilityRequirements, resolveModelAttribute, resolveModelAttribute, resolveValue, resolveValue, validateAndSet, validateOperation
-
-
-
-
Constructor Detail
-
SimpleAttributeDefinition
@Deprecated public SimpleAttributeDefinition(String name, org.jboss.dmr.ModelType type, boolean allowNull)
Deprecated.Creates a new attribute definition.- Parameters:
name
- the name of the attribute. Cannot benull
type
- the type of the attribute value. Cannot benull
allowNull
-true
ifModelType.UNDEFINED
is a valid type for the value
-
SimpleAttributeDefinition
protected SimpleAttributeDefinition(AbstractAttributeDefinitionBuilder<?,? extends SimpleAttributeDefinition> builder)
-
-
Method Detail
-
parse
@Deprecated public org.jboss.dmr.ModelNode parse(String value, XMLStreamReader reader) throws XMLStreamException
Deprecated.Creates and returns aModelNode
using the givenvalue
after first validating the node againstthis object's validator
.If
value
isnull
anundefined
node will be returned.- Parameters:
value
- the value. Will betrimmed
before use if notnull
.reader
-XMLStreamReader
from which thelocation
from which the attribute value was read can be obtained and used in anyXMLStreamException
, in case the given value is invalid.- Returns:
ModelNode
representing the parsed value- Throws:
XMLStreamException
- ifvalue
is not valid- See Also:
parseAndSetParameter(String, ModelNode, XMLStreamReader)
-
parseAndSetParameter
public void parseAndSetParameter(String value, org.jboss.dmr.ModelNode operation, XMLStreamReader reader) throws XMLStreamException
Creates aModelNode
using the givenvalue
after first validating the node againstthis object's validator
, and then stores it in the givenoperation
model node as a key/value pair whose key is this attribute'sname
.If
value
isnull
anundefined
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.
- Parameters:
value
- the value. Will betrimmed
before use if notnull
.operation
- model node of typeModelType.OBJECT
into which the parsed value should be storedreader
-XMLStreamReader
from which thelocation
from which the attribute value was read can be obtained and used in anyXMLStreamException
, in case the given value is invalid.- Throws:
XMLStreamException
- ifvalue
is not valid
-
marshallAsAttribute
public void marshallAsAttribute(org.jboss.dmr.ModelNode resourceModel, XMLStreamWriter writer) throws XMLStreamException
Marshalls the value from the givenresourceModel
as an xml attribute, if itis marshallable
.Invoking this method is the same as calling
marshallAsAttribute(resourceModel, true, writer)
- Parameters:
resourceModel
- the model, a non-null node ofModelType.OBJECT
.writer
- stream writer to use for writing the attribute- Throws:
XMLStreamException
- ifwriter
throws an exception
-
marshallAsAttribute
public void marshallAsAttribute(org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException
Marshalls the value from the givenresourceModel
as an xml attribute, if itis marshallable
.- Parameters:
resourceModel
- the model, a non-null node ofModelType.OBJECT
.marshallDefault
-true
if the value should be marshalled even if it matches the default valuewriter
- stream writer to use for writing the attribute- Throws:
XMLStreamException
- ifwriter
throws an exception
-
marshallAsElement
@Deprecated public void marshallAsElement(org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException
Deprecated.Marshalls the value from the givenresourceModel
as an xml element, if itis marshallable
. This implementation marshalls the attribute value as text content of the element.- Overrides:
marshallAsElement
in classAttributeDefinition
- Parameters:
marshallDefault
-resourceModel
- the model, a non-null node ofModelType.OBJECT
.writer
- stream writer to use for writing the attribute- Throws:
XMLStreamException
-
-