jadex.xml.reader.XMLReaderFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jadex-xml Show documentation
Show all versions of jadex-xml Show documentation
Jadex XML is an XML data binding framework for Java and also for other representations. The main idea of Jadex XML is that neither the XML-Schema on the one side nor the Java classes on the other side should define other binding. Instead, a separate mapping between both is used as a mediation. This allows designing the XML representation independent of the Java side but still being able to connect both as desired.
This idea was first put forward by the JiBX data binding framework. Jadex XML pushes it further by combining it with the configuration by exception principle. The framework can detect obvious correspondences between both sides automatically and only needs configuration information when translations are necessary. The configuration information is currently specified directly in form of Java configuration classes.
package jadex.xml.reader;
import java.util.logging.Level;
import java.util.logging.Logger;
import jadex.commons.SReflect;
import jadex.xml.stax.XMLReporter;
/**
* Factory to create XML Readers.
*/
public abstract class XMLReaderFactory
{
// -------- attributes --------
/** The instance of this factory */
private static XMLReaderFactory INSTANCE;
// -------- constructors --------
/** Constructor */
protected XMLReaderFactory()
{
}
// -------- methods --------
/**
* Returns the instance of this factory.
*
* @return the factory instance
*/
public static XMLReaderFactory getInstance()
{
if(INSTANCE == null)
{
if(SReflect.isAndroid())
{
Class< ? > clz;
try
{
clz = SReflect.classForName("jadex.xml.reader.XMLReaderFactoryAndroid", null);
if(clz != null)
{
INSTANCE = (XMLReaderFactory)clz.newInstance();
}
}
catch(ClassNotFoundException e)
{
Logger.getLogger("jadex").log(Level.WARNING, "XMLReader not available.");
}
catch(InstantiationException e)
{
e.printStackTrace();
}
catch(IllegalAccessException e)
{
e.printStackTrace();
}
}
else
{
INSTANCE = new XMLReaderFactoryDesktop();
}
}
return INSTANCE;
}
/**
* Creates a new default XML Reader.
*
* @return reader
*/
public abstract AReader createReader();
/**
* Creates a new XML Reader
*/
public abstract AReader createReader(boolean bulklink);
/**
* Creates a new XML Reader
*/
public abstract AReader createReader(boolean bulklink, boolean validate, XMLReporter reporter);
/**
* Creates a new XML Reader
*/
public abstract AReader createReader(boolean bulklink, boolean validate, boolean coalescing, XMLReporter reporter);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy