public class DefaultChemObjectBuilder extends Object implements IChemObjectBuilder
ICDKObject
s.
IChemObjectBuilder builder = DefaultChemObjectBuilder.getInstance();
IAtom a = builder.newInstance(IAtom.class);
IAtom c12 = builder.newInstance(IAtom.class, "C");
IAtom c13 = builder.newInstance(IAtom.class,
builder.newInstance(IIsotope.class,
"C", 13));
Modifier and Type | Method and Description |
---|---|
static IChemObjectBuilder |
getInstance()
Access the singleton instance of this DefaultChemObjectBuilder.
|
<T extends ICDKObject> |
newInstance(Class<T> clazz,
Object... params)
Creates a new instance of an
ICDKObject , using the constructor defined by the
given parameters. |
public static IChemObjectBuilder getInstance()
// get the builder instance
IChemObjectBuilder builder = DefaultChemObjectBuilder.getInstance();
// using the builder...
// create an IAtom using the default constructor
IAtom atom = builder.newInstance(IAtom.class);
// create a carbon atom
IAtom c1 = builder.newInstance(IAtom.class, "C");
public <T extends ICDKObject> T newInstance(Class<T> clazz, Object... params)
IChemObjectBuilder
ICDKObject
, using the constructor defined by the
given parameters.newInstance
in interface IChemObjectBuilder
T
- Class of an interface extending ICDKObject
or ICDKObject
itself.clazz
- Interface class to instantiate an instance for.params
- Parameters passed to the constructor of the created instance.Copyright © 2014. All Rights Reserved.