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

org.exolab.castor.xml.ClassDescriptorResolverFactory Maven / Gradle / Ivy

package org.exolab.castor.xml;

import org.castor.mapping.BindingType;
import org.exolab.castor.xml.util.XMLClassDescriptorResolverImpl;
import org.exolab.castor.xml.util.resolvers.CastorXMLStrategy;

/**
 * A factory that - based upon the binding type specified - returns {@link ClassDescriptorResolver}
 * instances.
 * 
 * @author Werner Guttmann
 *
 */
public class ClassDescriptorResolverFactory {

  /**
   * Returns the matching {@link ClassDescriptorResolver} instance.
   * 
   * @param type A binding type.
   * @return A {@link ClassDescriptorResolver} instance.
   */
  public static ClassDescriptorResolver createClassDescriptorResolver(final BindingType type) {
    if (type == BindingType.XML) {
      XMLClassDescriptorResolver resolver = new XMLClassDescriptorResolverImpl();
      // for cases in which users really work with the factory only and not
      // with any kind of InternalContext...
      resolver.setResolverStrategy(new CastorXMLStrategy());
      return resolver;
    }
    // TODO: throw IllegalArgumentException instead ?
    return null;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy