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 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
attributeMarshaller, COMPLEX_TYPES, referenceRecorder
-
-
Constructor Summary
Constructors Modifier Constructor Description SimpleAttributeDefinition(String name, org.jboss.dmr.ModelType type, boolean allowNull)Deprecated.protectedSimpleAttributeDefinition(AbstractAttributeDefinitionBuilder<?,? extends SimpleAttributeDefinition> builder)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated 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)Deprecated.org.jboss.dmr.ModelNodeparse(String value, XMLStreamReader reader)Deprecated.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, 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 benulltype- the type of the attribute value. Cannot benullallowNull-trueifModelType.UNDEFINEDis 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 aModelNodeusing the givenvalueafter first validating the node againstthis object's validator.If
valueisnullanundefinednode will be returned.- Parameters:
value- the value. Will betrimmedbefore use if notnull.reader-XMLStreamReaderfrom which thelocationfrom which the attribute value was read can be obtained and used in anyXMLStreamException, in case the given value is invalid.- Returns:
ModelNoderepresenting the parsed value- Throws:
XMLStreamException- ifvalueis not valid- See Also:
parseAndSetParameter(String, ModelNode, XMLStreamReader)
-
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
@Deprecated public void marshallAsElement(org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException
Deprecated.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
-
-