Class SimpleAttributeDefinition

    • Constructor Detail

      • SimpleAttributeDefinition

        @Deprecated
        public SimpleAttributeDefinition​(String name,
                                         org.jboss.dmr.ModelType type,
                                         boolean allowNull)
        Creates a new attribute definition.
        Parameters:
        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 value
    • Method Detail

      • parseAndSetParameter

        public void parseAndSetParameter​(String value,
                                         org.jboss.dmr.ModelNode operation,
                                         XMLStreamReader reader)
                                  throws XMLStreamException
        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.

        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.

        Parameters:
        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 stored
        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.
        Throws:
        XMLStreamException - if value is not valid
      • marshallAsAttribute

        public void marshallAsAttribute​(org.jboss.dmr.ModelNode resourceModel,
                                        XMLStreamWriter writer)
                                 throws XMLStreamException
        Marshalls the value from the given resourceModel as an xml attribute, if it is marshallable.

        Invoking this method is the same as calling marshallAsAttribute(resourceModel, true, writer)

        Parameters:
        resourceModel - the model, a non-null node of ModelType.OBJECT.
        writer - stream writer to use for writing the attribute
        Throws:
        XMLStreamException - if writer throws an exception
      • marshallAsAttribute

        public void marshallAsAttribute​(org.jboss.dmr.ModelNode resourceModel,
                                        boolean marshallDefault,
                                        XMLStreamWriter writer)
                                 throws XMLStreamException
        Marshalls the value from the given resourceModel as an xml attribute, if it is marshallable.
        Parameters:
        resourceModel - the model, a non-null node of ModelType.OBJECT.
        marshallDefault - true if the value should be marshalled even if it matches the default value
        writer - stream writer to use for writing the attribute
        Throws:
        XMLStreamException - if writer 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 given resourceModel as an xml element, if it is marshallable. This implementation marshalls the attribute value as text content of the element.
        Overrides:
        marshallAsElement in class AttributeDefinition
        Parameters:
        marshallDefault -
        resourceModel - the model, a non-null node of ModelType.OBJECT.
        writer - stream writer to use for writing the attribute
        Throws:
        XMLStreamException