/** * Returns the ClassDescriptorResolver to use during validation. * * @return the ClassDescriptorResolver to use. May be null. */ public XMLClassDescriptorResolver getClassDescriptorResolver() { return _internalContext.getXMLClassDescriptorResolver(); }
/** * Returns the ClassDescriptorResolver to use during validation. * * @return the ClassDescriptorResolver to use. May be null. */ public XMLClassDescriptorResolver getClassDescriptorResolver() { return _internalContext.getXMLClassDescriptorResolver(); }
/** * Loads the class descriptor for the class instance specified. The use of this method is useful * when no mapping is used, as happens when the domain classes hase been generated * using the XML code generator (in which case instead of a mapping file class * descriptor files will be generated). * * @param clazzes the classes for which the associated descriptor should be loaded. * @throws ResolverException in case that resolving the Class fails fatally */ public void addClasses(final Class[] clazzes) throws ResolverException { _internalContext.getXMLClassDescriptorResolver().addClasses(clazzes); }
/** * Loads the class descriptor for the class instance specified. The use of this method is useful * when no mapping is used, as happens when the domain classes hase been generated using the XML * code generator (in which case instead of a mapping file class descriptor files will be * generated). * * @param clazzes the classes for which the associated descriptor should be loaded. * @throws ResolverException in case that resolving the Class fails fatally */ public void addClasses(final Class[] clazzes) throws ResolverException { _internalContext.getXMLClassDescriptorResolver().addClasses(clazzes); }
/** * Loads the class descriptor for the class instance specified. The use of this method is useful * when no mapping is used, as happens when the domain classes has been generated using the XML * code generator (in which case instead of a mapping file class descriptor files will be * generated). * * @param clazz the class for which the associated descriptor should be loaded. * @throws ResolverException in case that resolving the Class fails fatally */ public void addClass(final Class clazz) throws ResolverException { _internalContext.getXMLClassDescriptorResolver().addClass(clazz); }
/** * Loads the class descriptor for the class instance specified. The use of this method is useful * when no mapping is used, as happens when the domain classes has been generated * using the XML code generator (in which case instead of a mapping file class * descriptor files will be generated). * * @param clazz the class for which the associated descriptor should be loaded. * @throws ResolverException in case that resolving the Class fails fatally */ public void addClass(final Class clazz) throws ResolverException { _internalContext.getXMLClassDescriptorResolver().addClass(clazz); }
/** * Loads class descriptors from the package specified. The use of this method is useful * when no mapping is used, as happens when the domain classes hase been generated * using the XML code generator (in which case instead of a mapping file class * descriptor files will be generated). * <p> * Please note that this functionality will work only if you provide the <tt>.castor.cdr</tt> * file with your generated classes (as generated by the XML code generator). * <p> * @param packageName The package name for the (descriptor) classes * @throws ResolverException * If there's a problem loading class descriptors for the given package. */ public void addPackage(final String packageName) throws ResolverException { _internalContext.getXMLClassDescriptorResolver().addPackage(packageName); }
/** * Loads class descriptors from the package specified. The use of this method is useful when no * mapping is used, as happens when the domain classes hase been generated using the XML code * generator (in which case instead of a mapping file class descriptor files will be generated). * <p> * Please note that this functionality will work only if you provide the <tt>.castor.cdr</tt> file * with your generated classes (as generated by the XML code generator). * <p> * * @param packageName The package name for the (descriptor) classes * @throws ResolverException If there's a problem loading class descriptors for the given package. */ public void addPackage(final String packageName) throws ResolverException { _internalContext.getXMLClassDescriptorResolver().addPackage(packageName); }
/** * Loads class descriptors from the packages specified. The use of this method is useful when no * mapping is used, as happens when the domain classes hase been generated using the XML code * generator (in which case instead of a mapping file class descriptor files will be generated). * <p> * Please note that this functionality will work only if you provide the <tt>.castor.cdr</tt> * files with your generated classes (as generated by the XML code generator). * <p> * * @param packageNames The package names for the (descriptor) classes * @throws ResolverException If there's a problem loading class descriptors for the given package. */ public void addPackages(final String[] packageNames) throws ResolverException { _internalContext.getXMLClassDescriptorResolver().addPackages(packageNames); }
/** * Loads class descriptors from the packages specified. The use of this method is useful * when no mapping is used, as happens when the domain classes hase been generated * using the XML code generator (in which case instead of a mapping file class * descriptor files will be generated). * <p> * Please note that this functionality will work only if you provide the <tt>.castor.cdr</tt> * files with your generated classes (as generated by the XML code generator). * <p> * @param packageNames The package names for the (descriptor) classes * @throws ResolverException * If there's a problem loading class descriptors for the given package. */ public void addPackages(final String[] packageNames) throws ResolverException { _internalContext.getXMLClassDescriptorResolver().addPackages(packageNames); }
/** * Returns the XMLClassLoader */ XMLClassDescriptor resolveByXMLName(String name, String namespace, ClassLoader loader) throws SAXException { try { return getInternalContext().getXMLClassDescriptorResolver().resolveByXMLName(name, namespace, loader); } catch (ResolverException rx) { throw new SAXException(rx); } }
/** * Returns the ClassDescriptorResolver for use during marshalling * * @return the ClassDescriptorResolver * @see #setResolver */ public XMLClassDescriptorResolver getResolver() { // if (_cdResolver == null) { // _cdResolver = (XMLClassDescriptorResolver) // ClassDescriptorResolverFactory.createClassDescriptorResolver(BindingType.XML); // } if ((getInternalContext() == null) || (getInternalContext().getXMLClassDescriptorResolver() == null)) { String message = "No internal context or no class descriptor in context."; LOG.warn(message); throw new IllegalStateException(message); } return getInternalContext().getXMLClassDescriptorResolver(); } //-- getResolver
/** * Returns the XMLClassLoader */ private XMLClassDescriptor resolveByXMLName (String name, String namespace, ClassLoader loader) throws SAXException { try { return getInternalContext().getXMLClassDescriptorResolver().resolveByXMLName(name, namespace, loader); } catch(ResolverException rx) { throw new SAXException(rx); } }
/** * Returns the ClassDescriptorResolver for use during marshalling * * @return the ClassDescriptorResolver * @see #setResolver */ public XMLClassDescriptorResolver getResolver() { // if (_cdResolver == null) { // _cdResolver = (XMLClassDescriptorResolver) // ClassDescriptorResolverFactory.createClassDescriptorResolver(BindingType.XML); // } if ((getInternalContext() == null) || (getInternalContext().getXMLClassDescriptorResolver() == null)) { String message = "No internal context or no class descriptor in context."; LOG.warn(message); throw new IllegalStateException(message); } return getInternalContext().getXMLClassDescriptorResolver(); } // -- getResolver
/** * Sets whether or not to look for and load package specific mapping files (".castor.xml" files). * * @param loadPackageMappings a boolean that enables or disables the loading of package specific * mapping files */ public void setLoadPackageMappings(final boolean loadPackageMappings) { if ((getInternalContext() == null) || (getInternalContext().getXMLClassDescriptorResolver() == null)) { String message = "Internal context or class descriptor resolver within are not valid"; LOG.warn(message); throw new IllegalStateException(message); } getInternalContext().getXMLClassDescriptorResolver() .setLoadPackageMappings(loadPackageMappings); } // -- setLoadPackageMappings
/** * Sets whether or not to look for and load package specific * mapping files (".castor.xml" files). * * @param loadPackageMappings a boolean that enables or * disables the loading of package specific mapping files */ public void setLoadPackageMappings(final boolean loadPackageMappings) { if ((getInternalContext() == null) || (getInternalContext().getXMLClassDescriptorResolver() == null)) { String message = "Internal context or class descriptor resolver within are not valid"; LOG.warn(message); throw new IllegalStateException(message); } getInternalContext() .getXMLClassDescriptorResolver() .setLoadPackageMappings(loadPackageMappings); } //-- setLoadPackageMappings
/** * Instructs Castor to load class descriptors from the mapping given. * * @param mapping Castor XML mapping (file), from which the required class descriptors will be * derived. * @throws MappingException If the {@link Mapping} cannot be loaded and analyzed successfully. */ public void addMapping(final Mapping mapping) throws MappingException { MappingUnmarshaller mappingUnmarshaller = new MappingUnmarshaller(); MappingLoader mappingLoader = mappingUnmarshaller.getMappingLoader(mapping, BindingType.XML); _internalContext.getXMLClassDescriptorResolver().setMappingLoader(mappingLoader); }
/** * Instructs Castor to load class descriptors from the mapping given. * @param mapping Castor XML mapping (file), from which the required class * descriptors will be derived. * @throws MappingException If the {@link Mapping} cannot be loaded and analyzed successfully. */ public void addMapping(final Mapping mapping) throws MappingException { MappingUnmarshaller mappingUnmarshaller = new MappingUnmarshaller(); MappingLoader mappingLoader = mappingUnmarshaller.getMappingLoader(mapping, BindingType.XML); _internalContext.getXMLClassDescriptorResolver() .setMappingLoader(mappingLoader); }
/** * Sets the Mapping to use during unmarshalling. If the Mapping has a ClassLoader it will be used * during unmarshalling. * * @param mapping Mapping to use during unmarshalling. * @see #setResolver */ public void setMapping(final Mapping mapping) throws MappingException { if (_loader == null) { _loader = mapping.getClassLoader(); } MappingUnmarshaller mum = new MappingUnmarshaller(); MappingLoader resolver = mum.getMappingLoader(mapping, BindingType.XML); _internalContext.getXMLClassDescriptorResolver().setMappingLoader(resolver); }
/** * Sets the Mapping to use during unmarshalling. If the Mapping has a ClassLoader it * will be used during unmarshalling. * * @param mapping Mapping to use during unmarshalling. * @see #setResolver */ public void setMapping(final Mapping mapping) throws MappingException { if (_loader == null) { _loader = mapping.getClassLoader(); } MappingUnmarshaller mum = new MappingUnmarshaller(); MappingLoader resolver = mum.getMappingLoader(mapping, BindingType.XML); _internalContext.getXMLClassDescriptorResolver().setMappingLoader(resolver); }