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
Defining characteristics of an attribute in a
Resource or a
parameter or reply value type field in an OperationDefinition, 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
ConstructorsModifierConstructorDescriptionprotectedSimpleAttributeDefinition(AbstractAttributeDefinitionBuilder<?, ? extends SimpleAttributeDefinition> builder) -
Method Summary
Modifier and TypeMethodDescriptionvoidmarshallAsAttribute(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, equals, 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, hashCode, isAllowed, isAllowExpression, isDeprecated, isMarshallable, isMarshallable, isNillable, isNullSignificant, isRequired, isRequired, isResourceOnly, marshallAsElement, removeCapabilityRequirements, resolveModelAttribute, resolveModelAttribute, resolveValue, resolveValue, toString, validateAndSet, validateOperation
-
Constructor Details
-
SimpleAttributeDefinition
protected SimpleAttributeDefinition(AbstractAttributeDefinitionBuilder<?, ? extends SimpleAttributeDefinition> builder)
-
-
Method Details
-
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 XMLStreamException Marshalls 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 XMLStreamException Marshalls 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 XMLStreamException Marshalls 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
-