001    package org.relaxng.datatype;
002    
003    /**
004     * A Datatype library
005     * 
006     * @author <a href="mailto:jjc@jclark.com">James Clark</a>
007     * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
008     */
009    public interface DatatypeLibrary {
010            
011            /**
012             * Creates a new instance of DatatypeBuilder.
013             * 
014             * The callee should throw a DatatypeException in case of an error.
015             * 
016             * @param baseTypeLocalName
017             *              The local name of the base type.
018             * 
019             * @return
020             *              A non-null valid datatype object.
021             */
022            DatatypeBuilder createDatatypeBuilder( String baseTypeLocalName )
023                    throws DatatypeException;
024            
025            /**
026             * Gets or creates a pre-defined type.
027             * 
028             * This is just a short-cut of
029             * <code>createDatatypeBuilder(typeLocalName).createDatatype();</code>
030             * 
031             * The callee should throw a DatatypeException in case of an error.
032             * 
033             * @return
034             *              A non-null valid datatype object.
035             */
036            Datatype createDatatype( String typeLocalName ) throws DatatypeException;
037    }