Package net.sf.jaxodraw.object
Class JaxoObjectFactory
- java.lang.Object
-
- net.sf.jaxodraw.object.JaxoObjectFactory
-
public final class JaxoObjectFactory extends java.lang.Object
Factory class to create instances of JaxoObjects.- Since:
- 2.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addObjectType(int type, java.lang.String objectId)
Adds a new type of JaxoObject to the list of know objects.static JaxoObject
newObject(int type)
Returns a new instance of a JaxoObject.static JaxoObject
newObject(int type, java.awt.Point[] location)
Creates a new JaxoObject, initialized with values taken from thePreferences
.static JaxoObject
newObject(java.lang.String objectId)
Returns a new instance of a JaxoObject.
-
-
-
Method Detail
-
newObject
public static JaxoObject newObject(int type)
Returns a new instance of a JaxoObject. The object is only instantiated, not initialized. A NoSuchElementException is thrown if type is not a known object.- Parameters:
type
- The type of object to be created, as defined inJaxoConstants
).- Returns:
- A new instance of a JaxoObject. Always non-null.
-
newObject
public static JaxoObject newObject(java.lang.String objectId)
Returns a new instance of a JaxoObject. The object is only instantiated, not initialized. A NoSuchElementException is thrown if objectId is not a known object.- Parameters:
objectId
- The class name of the object to be instantiated.- Returns:
- A new instance of a JaxoObject. Always non-null.
-
newObject
public static JaxoObject newObject(int type, java.awt.Point[] location)
Creates a new JaxoObject, initialized with values taken from thePreferences
. A NoSuchElementException is thrown if type is not a known object.- Parameters:
type
- The type of object to be created (defined inJaxoConstants
).location
- the points of the object. The size of the array has to be equal to the point count of the object.- Returns:
- A new JaxoObject. Always non-null.
-
addObjectType
public static void addObjectType(int type, java.lang.String objectId)
Adds a new type of JaxoObject to the list of know objects. No test is done here if the object can be instantiated.- Parameters:
type
- The type of object to be created, has to be different from any of the pre-defined types inJaxoConstants
).objectId
- The class name of the object of the given type. This is used to instantiate the object.
-
-