/** * Sets a config xml document source to get the entity XML Definition from as returned by {@link * XmlEntity#getXmlDefinition()}. Defaults to current active configuration for {@link Cache}. * * <p><b>Should only be used for testing.</b> * * @param document Config XML {@link Document}. * @return this {@link XmlEntityBuilder} * @throws TransformerException * @throws TransformerFactoryConfigurationError * @throws XPathExpressionException * @since 8.1 */ public XmlEntityBuilder withConfig(final Document document) throws XPathExpressionException, TransformerFactoryConfigurationError, TransformerException { xmlEntity.xmlDefinition = xmlEntity.loadXmlDefinition(document); return this; }
/** * Produce an {@link XmlEntity} with the supplied values. Builder is reset after {@link * #build()} is called. Subsequent calls will produce a new {@link XmlEntity}. * * <p>You are required to at least call {@link #withType(String)}. * * @return {@link XmlEntity} * @since 8.1 */ public XmlEntity build() { xmlEntity.init(); final XmlEntity built = xmlEntity; xmlEntity = new XmlEntity(); return built; }
/** * Sets a config xml document source to get the entity XML Definition from as returned by {@link * XmlEntity#getXmlDefinition()}. Defaults to current active configuration for {@link Cache}. * * <p><b>Should only be used for testing.</b> * * @param xmlDocument Config XML document. * @return this {@link XmlEntityBuilder} * @since 8.1 */ public XmlEntityBuilder withConfig(final String xmlDocument) { xmlEntity.xmlDefinition = xmlEntity.loadXmlDefinition(xmlDocument); return this; }
/** * Replaces all attributes with the supplied attributes {@link Map}. * * @param attributes {@link Map} to use. * @return this {@link XmlEntityBuilder} * @since 8.1 */ public XmlEntityBuilder withAttributes(final Map<String, String> attributes) { xmlEntity.attributes = attributes; return this; }
/** * Sets the element prefix and namespace as returned by {@link XmlEntity#getPrefix()} and {@link * XmlEntity#getNamespace()} respectively. Defaults are {@link CacheXml#PREFIX} and {@link * CacheXml#NAMESPACE} respectively. * * @param prefix Prefix of element * @param namespace Namespace of element * @return this {@link XmlEntityBuilder} * @since 8.1 */ public XmlEntityBuilder withNamespace(final String prefix, final String namespace) { xmlEntity.prefix = prefix; xmlEntity.namespace = namespace; return this; }
/** * Sets the type or element name value as returned by {@link XmlEntity#getType()} * * @param type Name of element type. * @return this {@link XmlEntityBuilder} * @since 8.1 */ public XmlEntityBuilder withType(final String type) { xmlEntity.type = type; return this; }