1 package org.exolab.castor.xml;
2
3 import org.castor.mapping.BindingType;
4 import org.exolab.castor.xml.util.XMLClassDescriptorResolverImpl;
5 import org.exolab.castor.xml.util.resolvers.CastorXMLStrategy;
6
7 /**
8 * A factory that - based upon the binding type specified - returns
9 * {@link ClassDescriptorResolver} instances.
10 *
11 * @author <a href="mailto: wguttmn AT codehaus DOT org">Werner Guttmann</a>
12 *
13 */
14 public class ClassDescriptorResolverFactory {
15
16 /**
17 * Returns the matching {@link ClassDescriptorResolver} instance.
18 * @param type A binding type.
19 * @return A {@link ClassDescriptorResolver} instance.
20 */
21 public static ClassDescriptorResolver createClassDescriptorResolver(final BindingType type) {
22 if (type == BindingType.XML) {
23 XMLClassDescriptorResolver resolver = new XMLClassDescriptorResolverImpl();
24 // for cases in which users really work with the factory only and not
25 // with any kind of InternalContext...
26 resolver.setResolverStrategy(new CastorXMLStrategy());
27 return resolver;
28 }
29 // TODO: throw IllegalArgumentException instead ?
30 return null;
31 }
32 }