Package org.jboss.as.controller
Class AttributeMarshaller
- java.lang.Object
-
- org.jboss.as.controller.AttributeMarshaller
-
- Direct Known Subclasses:
AttributeMarshaller.AttributeElementMarshaller
,AttributeMarshallers.MapAttributeMarshaller
,AttributeMarshallers.SimpleListAttributeMarshaller
,DefaultAttributeMarshaller
public abstract class AttributeMarshaller extends Object
- Author:
- Tomaz Cerar
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AttributeMarshaller.AttributeElementMarshaller
Version of marshaller that by default marshalls to element
-
Field Summary
Fields Modifier and Type Field Description static AttributeMarshaller
ATTRIBUTE_OBJECT
Marshaller for ObjectTypeAttributeDefinition.static AttributeMarshaller
COMMA_STRING_LIST
comma delimited list marshallerstatic AttributeMarshaller
ELEMENT_ONLY_OBJECT
Marshaller for ObjectTypeAttributeDefinition.static AttributeMarshaller
OBJECT_LIST_MARSHALLER
static AttributeMarshaller
OBJECT_MAP_MARSHALLER
static AttributeMarshaller
PROPERTIES_MARSHALLER
static AttributeMarshaller
PROPERTIES_MARSHALLER_UNWRAPPED
static AttributeMarshaller
SIMPLE
simple marshallerstatic AttributeMarshaller
STRING_LIST
space delimited list marshallerstatic AttributeMarshaller
UNWRAPPED_OBJECT_LIST_MARSHALLER
static AttributeMarshaller
WRAPPED_OBJECT_LIST_MARSHALLER
-
Constructor Summary
Constructors Constructor Description AttributeMarshaller()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isMarshallable(AttributeDefinition attribute, org.jboss.dmr.ModelNode resourceModel)
Gets whether the givenresourceModel
has a value for this attribute that should be marshalled to XML.boolean
isMarshallable(AttributeDefinition attribute, org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault)
Gets whether the givenresourceModel
has a value for this attribute that should be marshalled to XML.boolean
isMarshallableAsElement()
void
marshall(AttributeDefinition attribute, org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer)
void
marshallAsAttribute(AttributeDefinition attribute, org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer)
Marshalls the value from the givenresourceModel
as an xml element, if itis marshallable
.void
marshallAsElement(AttributeDefinition attribute, org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer)
static void
marshallElementContent(String content, XMLStreamWriter writer)
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.
-
-
-
Field Detail
-
SIMPLE
public static final AttributeMarshaller SIMPLE
simple marshaller
-
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
-
OBJECT_LIST_MARSHALLER
public static final AttributeMarshaller OBJECT_LIST_MARSHALLER
-
OBJECT_MAP_MARSHALLER
public static final AttributeMarshaller OBJECT_MAP_MARSHALLER
-
PROPERTIES_MARSHALLER
public static final AttributeMarshaller PROPERTIES_MARSHALLER
-
PROPERTIES_MARSHALLER_UNWRAPPED
public static final AttributeMarshaller PROPERTIES_MARSHALLER_UNWRAPPED
-
-
Method Detail
-
isMarshallable
public boolean isMarshallable(AttributeDefinition attribute, org.jboss.dmr.ModelNode resourceModel)
Gets whether the givenresourceModel
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 doneresourceModel
- the model, a non-null node ofModelType.OBJECT
.- Returns:
true
if the givenresourceModel
has a defined value under this attribute'sAttributeDefinition.getName()
() name}.
-
isMarshallable
public boolean isMarshallable(AttributeDefinition attribute, org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault)
Gets whether the givenresourceModel
has a value for this attribute that should be marshalled to XML.- Parameters:
attribute
- - attribute for which marshaling is being doneresourceModel
- the model, a non-null node ofModelType.OBJECT
.marshallDefault
-true
if the value should be marshalled even if it matches the default value- Returns:
true
if the givenresourceModel
has a defined value under this attribute'sAttributeDefinition.getName()
() name} andmarshallDefault
istrue
or that value differs from this attribute'sdefault value
.
-
marshallAsAttribute
public void marshallAsAttribute(AttributeDefinition attribute, org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException
Marshalls the value from the givenresourceModel
as an xml element, if itis marshallable
.- Parameters:
attribute
- - attribute for which marshaling is being doneresourceModel
- the model, a non-null node ofModelType.OBJECT
.writer
- stream writer to use for writing the attribute- Throws:
XMLStreamException
- if thrown bywriter
-
marshallAsElement
public void marshallAsElement(AttributeDefinition attribute, org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException
- Throws:
XMLStreamException
-
isMarshallableAsElement
public boolean isMarshallableAsElement()
-
marshall
public void marshall(AttributeDefinition attribute, org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException
- Throws:
XMLStreamException
-
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 benull
writer
- the writer. Cannot benull
- Throws:
XMLStreamException
-
-