private static void writeElement(XMLExtendedStreamWriter writer, ModelNode model, Attribute attribute) throws XMLStreamException { attribute.getDefinition().getMarshaller().marshallAsElement(attribute.getDefinition(), model, true, writer); } }
private static void writeElement(XMLExtendedStreamWriter writer, ModelNode model, Attribute attribute) throws XMLStreamException { attribute.getDefinition().getMarshaller().marshallAsElement(attribute.getDefinition(), model, true, writer); }
private static void writeElement(XMLExtendedStreamWriter writer, ModelNode model, Attribute attribute) throws XMLStreamException { attribute.getDefinition().getMarshaller().marshallAsElement(attribute.getDefinition(), model, false, writer); } }
private static void writeAttribute(XMLExtendedStreamWriter writer, ModelNode model, Attribute attribute) throws XMLStreamException { attribute.getDefinition().getMarshaller().marshallAsAttribute(attribute.getDefinition(), model, true, writer); }
private static void writeAttribute(XMLExtendedStreamWriter writer, ModelNode model, Attribute attribute) throws XMLStreamException { attribute.getDefinition().getMarshaller().marshallAsAttribute(attribute.getDefinition(), model, true, writer); }
private static void writeAttribute(XMLExtendedStreamWriter writer, ModelNode model, Attribute attribute) throws XMLStreamException { attribute.getDefinition().getMarshaller().marshallAsAttribute(attribute.getDefinition(), model, true, writer); }
private static void writeAttribute(XMLExtendedStreamWriter writer, ModelNode model, Attribute attribute) throws XMLStreamException { attribute.getDefinition().getMarshaller().marshallAsAttribute(attribute.getDefinition(), model, false, writer); }
/** * Gets whether the given {@code resourceModel} has a value for this attribute that should be marshalled to XML. * * @param resourceModel the model, a non-null node of {@link ModelType#OBJECT}. * @param marshallDefault {@code true} if the value should be marshalled even if it matches the default value * * @return {@code true} if the given {@code resourceModel} has a defined value under this attribute's {@link #getName()} () name} * and {@code marshallDefault} is {@code true} or that value differs from this attribute's {@link #getDefaultValue() default value}. */ public boolean isMarshallable(final ModelNode resourceModel, final boolean marshallDefault) { return getMarshaller().isMarshallable(this, resourceModel, marshallDefault); }
private boolean isMarshallable(AttributeDefinition[] valueTypes, ModelNode element){ for (AttributeDefinition valueType : valueTypes) { if (valueType.getMarshaller().isMarshallable(valueType, element)){ return true; } } return false; }
/** * Gets whether the given {@code resourceModel} has a value for this attribute that should be marshalled to XML. * * @param resourceModel the model, a non-null node of {@link ModelType#OBJECT}. * @param marshallDefault {@code true} if the value should be marshalled even if it matches the default value * * @return {@code true} if the given {@code resourceModel} has a defined value under this attribute's {@link #getName()} () name} * and {@code marshallDefault} is {@code true} or that value differs from this attribute's {@link #getDefaultValue() default value}. */ public boolean isMarshallable(final ModelNode resourceModel, final boolean marshallDefault) { return getMarshaller().isMarshallable(this, resourceModel, marshallDefault); }
private boolean isMarshallable(AttributeDefinition[] valueTypes, ModelNode element){ for (AttributeDefinition valueType : valueTypes) { if (valueType.getMarshaller().isMarshallable(valueType, element)){ return true; } } return false; }
/** * Gets whether the given {@code resourceModel} has a value for this attribute that should be marshalled to XML. * <p> * This is the same as {@code isMarshallable(resourceModel, true)}. * </p> * * @param resourceModel the model, a non-null node of {@link ModelType#OBJECT}. * * @return {@code true} if the given {@code resourceModel} has a defined value under this attribute's {@link #getName()} () name}. */ public boolean isMarshallable(final ModelNode resourceModel) { return getMarshaller().isMarshallable(this, resourceModel, true); }
/** * Gets whether the given {@code resourceModel} has a value for this attribute that should be marshalled to XML. * <p> * This is the same as {@code isMarshallable(resourceModel, true)}. * </p> * * @param resourceModel the model, a non-null node of {@link ModelType#OBJECT}. * * @return {@code true} if the given {@code resourceModel} has a defined value under this attribute's {@link #getName()} () name}. */ public boolean isMarshallable(final ModelNode resourceModel) { return getMarshaller().isMarshallable(this, resourceModel, true); }
private static void writeAttribute(XMLExtendedStreamWriter writer, ModelNode model, AttributeDefinition attribute) throws XMLStreamException { attribute.getMarshaller().marshallAsAttribute(attribute, model, true, writer); } }
void writeElements(XMLStreamWriter writer, ObjectTypeAttributeDefinition objectType, AttributeDefinition[] valueTypes, List<ModelNode> elements) throws XMLStreamException { for (ModelNode element : elements) { if (isMarshallable(valueTypes, element)) { writer.writeStartElement(objectType.getXmlName()); Set<AttributeDefinition> sortedAttrs = sortAttributes(valueTypes); for (AttributeDefinition valueType : sortedAttrs) { valueType.getMarshaller().marshall(valueType, element, false, writer); } writer.writeEndElement(); } } }
void writeElements(XMLStreamWriter writer, ObjectTypeAttributeDefinition objectType, AttributeDefinition[] valueTypes, List<ModelNode> elements) throws XMLStreamException { for (ModelNode element : elements) { if (isMarshallable(valueTypes, element)) { writer.writeStartElement(objectType.getXmlName()); Set<AttributeDefinition> sortedAttrs = sortAttributes(valueTypes); for (AttributeDefinition valueType : sortedAttrs) { valueType.getMarshaller().marshall(valueType, element, false, writer); } writer.writeEndElement(); } } }
/** * Marshalls the value from the given {@code resourceModel} as an xml element, if it * {@link #isMarshallable(org.jboss.dmr.ModelNode, boolean) is marshallable}. * * @param resourceModel the model, a non-null node of {@link org.jboss.dmr.ModelType#OBJECT}. * @param marshallDefault {@code true} if the value should be marshalled even if it matches the default value * @param writer stream writer to use for writing the attribute * @throws javax.xml.stream.XMLStreamException if thrown by {@code writer} */ public void marshallAsElement(final ModelNode resourceModel, final boolean marshallDefault, final XMLStreamWriter writer) throws XMLStreamException { if (getMarshaller().isMarshallableAsElement()) { getMarshaller().marshallAsElement(this, resourceModel, marshallDefault, writer); } else { throw ControllerLogger.ROOT_LOGGER.couldNotMarshalAttributeAsElement(getName()); } }
private static void writeElement(XMLExtendedStreamWriter writer, ModelNode model, Attribute attribute) throws XMLStreamException { attribute.getDefinition().getMarshaller().marshallAsElement(attribute.getDefinition(), model, false, writer); } }
@Override public void marshallSingleElement(AttributeDefinition attribute, ModelNode property, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException { ObjectMapAttributeDefinition map = ((ObjectMapAttributeDefinition) attribute); AttributeDefinition[] valueTypes = map.getValueType().getValueTypes(); writer.writeEmptyElement(elementName); Property p = property.asProperty(); writer.writeAttribute(keyAttributeName, p.getName()); for (AttributeDefinition valueType : valueTypes) { valueType.getMarshaller().marshall(valueType, p.getValue(), false, writer); } } }
@Override public void marshallSingleElement(AttributeDefinition attribute, ModelNode property, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException { ObjectMapAttributeDefinition map = ((ObjectMapAttributeDefinition) attribute); AttributeDefinition[] valueTypes = map.getValueType().getValueTypes(); writer.writeEmptyElement(elementName); Property p = property.asProperty(); writer.writeAttribute(keyAttributeName, p.getName()); for (AttributeDefinition valueType : valueTypes) { valueType.getMarshaller().marshall(valueType, p.getValue(), false, writer); } } }