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 classAttributeMarshaller.AttributeElementMarshallerVersion of marshaller that by default marshalls to element
-
Field Summary
Fields Modifier and Type Field Description static AttributeMarshallerATTRIBUTE_OBJECTMarshaller for ObjectTypeAttributeDefinition.static AttributeMarshallerCOMMA_STRING_LISTcomma delimited list marshallerstatic AttributeMarshallerELEMENT_ONLY_OBJECTMarshaller for ObjectTypeAttributeDefinition.static AttributeMarshallerOBJECT_LIST_MARSHALLERstatic AttributeMarshallerOBJECT_MAP_MARSHALLERstatic AttributeMarshallerPROPERTIES_MARSHALLERstatic AttributeMarshallerPROPERTIES_MARSHALLER_UNWRAPPEDstatic AttributeMarshallerSIMPLEsimple marshallerstatic AttributeMarshallerSTRING_LISTspace delimited list marshallerstatic AttributeMarshallerUNWRAPPED_OBJECT_LIST_MARSHALLERstatic AttributeMarshallerWRAPPED_OBJECT_LIST_MARSHALLER
-
Constructor Summary
Constructors Constructor Description AttributeMarshaller()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisMarshallable(AttributeDefinition attribute, org.jboss.dmr.ModelNode resourceModel)Gets whether the givenresourceModelhas a value for this attribute that should be marshalled to XML.booleanisMarshallable(AttributeDefinition attribute, org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault)Gets whether the givenresourceModelhas a value for this attribute that should be marshalled to XML.booleanisMarshallableAsElement()voidmarshall(AttributeDefinition attribute, org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer)voidmarshallAsAttribute(AttributeDefinition attribute, org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer)Marshalls the value from the givenresourceModelas an xml element, if itis marshallable.voidmarshallAsElement(AttributeDefinition attribute, org.jboss.dmr.ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer)static voidmarshallElementContent(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 givenresourceModelhas 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:
trueif the givenresourceModelhas 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 givenresourceModelhas 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-trueif the value should be marshalled even if it matches the default value- Returns:
trueif the givenresourceModelhas a defined value under this attribute'sAttributeDefinition.getName()() name} andmarshallDefaultistrueor 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 givenresourceModelas 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 benullwriter- the writer. Cannot benull- Throws:
XMLStreamException
-
-