Class AttributeMarshaller

    • Field Detail

      • STRING_LIST

        public static final AttributeMarshaller STRING_LIST
        space delimited list marshaller
      • COMMA_STRING_LIST

        public static final AttributeMarshaller COMMA_STRING_LIST
        comma delimited list marshaller
      • ELEMENT_ONLY_OBJECT

        public static final AttributeMarshaller ELEMENT_ONLY_OBJECT
        Marshaller for ObjectTypeAttributeDefinition. The object and all its attributes will be marshalled as element only.
      • ATTRIBUTE_OBJECT

        public static final AttributeMarshaller ATTRIBUTE_OBJECT
        Marshaller for ObjectTypeAttributeDefinition. The object and all its complex types descendants will get marshalled as elements whereas simple types will get marshalled as attributes.
      • WRAPPED_OBJECT_LIST_MARSHALLER

        public static final AttributeMarshaller WRAPPED_OBJECT_LIST_MARSHALLER
      • UNWRAPPED_OBJECT_LIST_MARSHALLER

        public static final AttributeMarshaller UNWRAPPED_OBJECT_LIST_MARSHALLER
      • PROPERTIES_MARSHALLER_UNWRAPPED

        public static final AttributeMarshaller PROPERTIES_MARSHALLER_UNWRAPPED
    • Constructor Detail

      • AttributeMarshaller

        public AttributeMarshaller()
    • Method Detail

      • isMarshallable

        public boolean isMarshallable​(AttributeDefinition attribute,
                                      org.jboss.dmr.ModelNode resourceModel)
        Gets whether the given resourceModel has a value for this attribute that should be marshalled to XML.

        This is the same as isMarshallable(resourceModel, true).

        Parameters:
        attribute - - attribute for which marshaling is being done
        resourceModel - the model, a non-null node of ModelType.OBJECT.
        Returns:
        true if the given resourceModel has a defined value under this attribute's AttributeDefinition.getName() () name}.
      • isMarshallable

        public boolean isMarshallable​(AttributeDefinition attribute,
                                      org.jboss.dmr.ModelNode resourceModel,
                                      boolean marshallDefault)
        Gets whether the given resourceModel has a value for this attribute that should be marshalled to XML.
        Parameters:
        attribute - - attribute for which marshaling is being done
        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
        Returns:
        true if the given resourceModel has a defined value under this attribute's AttributeDefinition.getName() () name} and marshallDefault is true or that value differs from this attribute's default value.
      • marshallAsAttribute

        public void marshallAsAttribute​(AttributeDefinition attribute,
                                        org.jboss.dmr.ModelNode resourceModel,
                                        boolean marshallDefault,
                                        XMLStreamWriter writer)
                                 throws XMLStreamException
        Marshalls the value from the given resourceModel as an xml element, if it is marshallable.
        Parameters:
        attribute - - attribute for which marshaling is being done
        resourceModel - the model, a non-null node of ModelType.OBJECT.
        writer - stream writer to use for writing the attribute
        Throws:
        XMLStreamException - if thrown by writer
      • isMarshallableAsElement

        public boolean isMarshallableAsElement()
      • marshallElementContent

        public static void marshallElementContent​(String content,
                                                  XMLStreamWriter writer)
                                           throws XMLStreamException
        Applies standard element text formatting such that multiline content is on a new line from the element wrapping the text and is indented one level. Single-line content is on the same line as the element.
        Parameters:
        content - the content. Cannot be null
        writer - the writer. Cannot be null
        Throws:
        XMLStreamException