All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.xmlbeam.ProjectionFactory Maven / Gradle / Ivy

Go to download

The coolest XML library for Java around. Define typesafe views (projections) to xml. Use XPath to read and write XML. Bind XML to Java collections. Requires at least Java6, supports Java8 features and has no further runtime dependencies.

There is a newer version: 1.4.24
Show newest version
/**
 *  Copyright 2013 Sven Ewald
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package org.xmlbeam;

import org.w3c.dom.Node;

/**
 */
public interface ProjectionFactory {

    /**
     * Create a new projection for an empty document. Use this to create new documents.
     * 
     * @param projectionInterface
     * @return a new projection instance
     */
     T projectEmptyDocument(Class projectionInterface);

    /**
     * Create a new projection for an empty element. Use this to create new elements.
     * 
     * @param name
     *            Element name
     * @param projectionInterface
     * @return a new projection instance
     */
     T projectEmptyElement(final String name, Class projectionInterface);

    /**
     * Creates a projection from XML Documents or Elements to Java.
     * 
     * @param documentOrElement
     *            XML DOM Node. May be a document or just an element.
     * @param projectionInterface
     *            A Java interface to project the data on.
     * @return a new instance of projectionInterface.
     */
     T projectDOMNode(final Node documentOrElement, final Class projectionInterface);

    /**
     * Creates a projection from XML content to Java.
     * 
     * @param xmlContent
     *            a string with XML content
     * @param projectionInterface
     *            A Java interface to project the data on.
     * @return a new instance of projectionInterface.
     */
     T projectXMLString(final String xmlContent, final Class projectionInterface);

    /**
     * Convert a projection to XML string.
     * @param projection
     * @return XML string.
     */
    String asString(Object projection);

    /**
     * Access a projection IO factory.
     * @return a {@link org.xmlbeam.ProjectionIO}
     */
    ProjectionIO io();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy