Class DefaultClassHolder<T>
- java.lang.Object
-
- org.apache.commons.discovery.tools.DefaultClassHolder<T>
-
public class DefaultClassHolder<T> extends java.lang.Object
Holder for a default class. Class may be specified by name (String) or class (Class). Using the holder complicates the users job, but minimized # of API's.
-
-
Constructor Summary
Constructors Constructor Description DefaultClassHolder(java.lang.Class<S> defaultClass)
Creates a new holder implementation given the input SPI implementation/extension class.DefaultClassHolder(java.lang.String defaultName)
Creates a new holder implementation given the input SPI implementation/extension class name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <S extends T>
java.lang.Class<S>getDefaultClass(SPInterface<T> spi, ClassLoaders loaders)
Returns the default class, loading it if necessary and verifying that it implements the SPI (this forces the check, no way out..).java.lang.String
getDefaultName()
Returns the hold class name.
-
-
-
Constructor Detail
-
DefaultClassHolder
public DefaultClassHolder(java.lang.Class<S> defaultClass)
Creates a new holder implementation given the input SPI implementation/extension class.- Type Parameters:
S
- Any type extends the SPI type- Parameters:
defaultClass
- The hold class
-
DefaultClassHolder
public DefaultClassHolder(java.lang.String defaultName)
Creates a new holder implementation given the input SPI implementation/extension class name.- Parameters:
defaultName
- The hold class name
-
-
Method Detail
-
getDefaultClass
public <S extends T> java.lang.Class<S> getDefaultClass(SPInterface<T> spi, ClassLoaders loaders)
Returns the default class, loading it if necessary and verifying that it implements the SPI (this forces the check, no way out..).- Type Parameters:
S
- Any type extends the SPI type- Parameters:
spi
- non-null SPIloaders
- Used only if class needs to be loaded.- Returns:
- The default Class.
-
getDefaultName
public java.lang.String getDefaultName()
Returns the hold class name.- Returns:
- The hold class name
-
-