Package org.jboss.as.controller
Class SimpleAttributeDefinition
- java.lang.Object
-
- org.jboss.as.controller.AttributeDefinition
-
- org.jboss.as.controller.SimpleAttributeDefinition
-
- All Implemented Interfaces:
Feature
- Direct Known Subclasses:
ObjectTypeAttributeDefinition
public class SimpleAttributeDefinition extends AttributeDefinition
Defining characteristics of an attribute in aResourceor 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
COMPLEX_TYPES
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSimpleAttributeDefinition(AbstractAttributeDefinitionBuilder<?,? extends SimpleAttributeDefinition> builder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidmarshallAsAttribute(org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer)Marshalls the value from the givenresourceModelas an xml attribute, if itis marshallable.voidmarshallAsAttribute(org.jboss.dmr.ModelNode resourceModel, XMLStreamWriter writer)Marshalls the value from the givenresourceModelas an xml attribute, if itis marshallable.voidmarshallAsElement(org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer)Marshalls the value from the givenresourceModelas an xml element, if itis marshallable.voidparseAndSetParameter(String value, org.jboss.dmr.ModelNode operation, XMLStreamReader reader)Creates aModelNodeusing the givenvalueafter first validating the node againstthis object's validator, and then stores it in the givenoperationmodel node as a key/value pair whose key is this attribute'sname.-
Methods inherited from class org.jboss.as.controller.AttributeDefinition
addAccessConstraints, addAllowedValuesToDescription, addCapabilityRequirements, addDeprecatedInfo, addOperationParameterDescription, addOperationParameterDescription, addOperationReplyDescription, addOperationReplyDescription, addResourceAttributeDescription, addResourceAttributeDescription, convertParameterExpressions, convertStringExpression, correctValue, getAccessConstraints, getAllowedValues, getAlternatives, getArbitraryDescriptors, getAttributeDeprecatedDescription, getAttributeGroup, getAttributeTextDescription, getCorrector, getDefaultValue, getDeprecationData, getFlags, getMarshaller, getMeasurementUnit, getName, getNoTextDescription, getParser, getReferenceRecorder, getRequires, getStability, getType, getUndefinedMetricValue, getValidator, getXmlName, hasAlternative, hasCapabilityRequirements, isAllowed, isAllowExpression, isDeprecated, isMarshallable, isMarshallable, isNillable, isNullSignificant, isRequired, isRequired, isResourceOnly, marshallAsElement, removeCapabilityRequirements, resolveModelAttribute, resolveModelAttribute, resolveValue, resolveValue, validateAndSet, validateOperation
-
-
-
-
Constructor Detail
-
SimpleAttributeDefinition
protected SimpleAttributeDefinition(AbstractAttributeDefinitionBuilder<?,? extends SimpleAttributeDefinition> builder)
-
-
Method Detail
-
parseAndSetParameter
public void parseAndSetParameter(String value, org.jboss.dmr.ModelNode operation, XMLStreamReader reader) throws XMLStreamException
Creates aModelNodeusing the givenvalueafter first validating the node againstthis object's validator, and then stores it in the givenoperationmodel node as a key/value pair whose key is this attribute'sname.If
valueisnullanundefinednode 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 betrimmedbefore use if notnull.operation- model node of typeModelType.OBJECTinto which the parsed value should be storedreader-XMLStreamReaderfrom which thelocationfrom which the attribute value was read can be obtained and used in anyXMLStreamException, in case the given value is invalid.- Throws:
XMLStreamException- ifvalueis not valid
-
marshallAsAttribute
public void marshallAsAttribute(org.jboss.dmr.ModelNode resourceModel, XMLStreamWriter writer) throws XMLStreamExceptionMarshalls the value from the givenresourceModelas 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- ifwriterthrows an exception
-
marshallAsAttribute
public void marshallAsAttribute(org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamExceptionMarshalls the value from the givenresourceModelas an xml attribute, if itis marshallable.- Parameters:
resourceModel- the model, a non-null node ofModelType.OBJECT.marshallDefault-trueif the value should be marshalled even if it matches the default valuewriter- stream writer to use for writing the attribute- Throws:
XMLStreamException- ifwriterthrows an exception
-
marshallAsElement
public void marshallAsElement(org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamExceptionMarshalls the value from the givenresourceModelas an xml element, if itis marshallable. This implementation marshalls the attribute value as text content of the element.- Overrides:
marshallAsElementin classAttributeDefinition- Parameters:
marshallDefault-resourceModel- the model, a non-null node ofModelType.OBJECT.writer- stream writer to use for writing the attribute- Throws:
XMLStreamException
-
-