Package org.openscience.cdk.interfaces
Interface IChemObjectBuilder
- All Known Implementing Classes:
DebugChemObjectBuilder,DefaultChemObjectBuilder,SilentChemObjectBuilder
public interface IChemObjectBuilder
A helper class to instantiate a
ICDKObject instance for a specific
implementation.- Author:
- egonw
-
Method Summary
Modifier and TypeMethodDescriptionstatic IChemObjectBuilderfind()This function is used to find an IChemObject builder using reflection.newAtom()Create a new atom using the default constructor.Create a new atom container using the default constructor.newBond()Create a new bond using the default constructor.<T extends ICDKObject>
TnewInstance(Class<T> clazz, Object... params) Creates a new instance of anICDKObject, using the constructor defined by the given parameters.Create a new reaction using the default constructor.
-
Method Details
-
newInstance
<T extends ICDKObject> T newInstance(Class<T> clazz, Object... params) throws IllegalArgumentException Creates a new instance of anICDKObject, using the constructor defined by the given parameters.- Type Parameters:
T- Class of an interface extendingICDKObjectorICDKObjectitself.- Parameters:
clazz- Interface class to instantiate an instance for.params- Parameters passed to the constructor of the created instance.- Returns:
- Instance created.
- Throws:
IllegalArgumentException- Exception thrown when theIChemObjectBuilderbuilder cannot instantiate theclazzwith the given parameters.
-
newAtom
IAtom newAtom()Create a new atom using the default constructor. This method is considerably faster than the dynamic dispatch ofnewInstance(IAtom.class)and should be used for high throughput applications (e.g. IO).- Returns:
- new atom
-
newBond
IBond newBond()Create a new bond using the default constructor. This method is considerably faster than the dynamic dispatch ofnewInstance(IBond.class)and should be used for high throughput applications (e.g. IO).- Returns:
- new bond
-
newAtomContainer
IAtomContainer newAtomContainer()Create a new atom container using the default constructor. This method is considerably faster than the dynamic dispatch ofnewInstance(IAtomContainer.class)and should be used for high throughput applications (e.g. IO).- Returns:
- the new atom container
-
newReaction
IReaction newReaction()Create a new reaction using the default constructor. This method is considerably faster than the dynamic dispatch ofnewInstance(IReaction.class)and should be used for high throughput applications (e.g. IO).- Returns:
- the new reaction
-
find
This function is used to find an IChemObject builder using reflection. It first tries to create a SilentChemObjectBuilder and failing that a DefaultChemObjectBuilder. It should be used sparingly since APIs should require a builder is passed in.- Returns:
- the IChemObject builder
-