cdm/src/main/java/ucar/nc2/ft/FeatureDatasetFactoryManager.java
static public void registerFactory(Class c) {

    if (!(FeatureDatasetFactory.class.isAssignableFrom(c)))
      throw new IllegalArgumentException("Class " + c.getName() + " must implement FeatureDatasetFactory");

    // fail fast - get Instance
    Object instance;
    try {
      instance = c.newInstance();
    } catch (InstantiationException e) {
      throw new IllegalArgumentException("FeatureDatasetFactoryManager Class " + c.getName() + " cannot instantiate, probably need default Constructor");
    } catch (IllegalAccessException e) {
      throw new IllegalArgumentException("FeatureDatasetFactoryManager Class " + c.getName() + " is not accessible");
    }

    // find out what type of Features
    try {
      Method m = c.getMethod("getFeatureTypes", new Class[0]);
      FeatureType[] result = (FeatureType[]) m.invoke(instance, new Object[0]);
      for (FeatureType ft : result) {
        if (userMode)
          factoryList.add(0, new Factory(ft, c, (FeatureDatasetFactory) instance));
        else
          factoryList.add(new Factory(ft, c, (FeatureDatasetFactory) instance));
      }
    } catch (Exception ex) {
      throw new IllegalArgumentException("FeatureDatasetFactoryManager Class " + c.getName() + " failed invoking getFeatureType()", ex);
    }
  }
static public void registerFactory(Class c) {

    if (!(FeatureDatasetFactory.class.isAssignableFrom(c)))
      throw new IllegalArgumentException("Class " + c.getName() + " must implement FeatureDatasetFactory");

    // fail fast - get Instance
    Object instance;
    try {
      instance = c.newInstance();
    } catch (InstantiationException e) {
      throw new IllegalArgumentException("FeatureDatasetFactoryManager Class " + c.getName() + " cannot instantiate, probably need default Constructor");
    } catch (IllegalAccessException e) {
      throw new IllegalArgumentException("FeatureDatasetFactoryManager Class " + c.getName() + " is not accessible");
    }

    // find out what type of Features
    try {
      Method m = c.getMethod("getFeatureTypes", new Class[0]);
      FeatureType[] result = (FeatureType[]) m.invoke(instance, new Object[0]);
      for (FeatureType ft : result) {
        if (userMode)
          factoryList.add(0, new Factory(ft, c, (FeatureDatasetFactory) instance));
        else
          factoryList.add(new Factory(ft, c, (FeatureDatasetFactory) instance));
      }
    } catch (Exception ex) {
      throw new IllegalArgumentException("FeatureDatasetFactoryManager Class " + c.getName() + " failed invoking getFeatureType()", ex);
    }
  }
static public void registerFactory ( Class c ) { if ( ! ( FeatureDatasetFactory . class . isAssignableFrom ( c ) ) ) throw new IllegalArgumentException ( "Class " + c . getName ( ) + " must implement FeatureDatasetFactory" ) ; // fail fast - get Instance
 Object instance ; try { instance = c . newInstance ( ) ; } catch ( InstantiationException e ) { throw new IllegalArgumentException ( "FeatureDatasetFactoryManager Class " + c . getName ( ) + " cannot instantiate, probably need default Constructor" ) ; } catch ( IllegalAccessException e ) { throw new IllegalArgumentException ( "FeatureDatasetFactoryManager Class " + c . getName ( ) + " is not accessible" ) ; } // find out what type of Features
 try { Method m = c . getMethod ( "getFeatureTypes" , new Class [ 0 ] ) ; FeatureType [ ] result = ( FeatureType [ ] ) m . invoke ( instance , new Object [ 0 ] ) ; for ( FeatureType ft : result ) { if ( userMode ) factoryList . add ( 0 , new Factory ( ft , c , ( FeatureDatasetFactory ) instance ) ) ; else factoryList . add ( new Factory ( ft , c , ( FeatureDatasetFactory ) instance ) ) ; } } catch ( Exception ex ) { throw new IllegalArgumentException ( "FeatureDatasetFactoryManager Class " + c . getName ( ) + " failed invoking getFeatureType()" , ex ) ; } }
Register a class that implements a FeatureDatasetFactory.
Find out which type by calling getFeatureType().

@param c class that implements FeatureDatasetFactory.
Register a class that implements a FeatureDatasetFactory . Find out which type by calling getFeatureType () .