Class JaxoObjectFactory

java.lang.Object
net.sf.jaxodraw.object.JaxoObjectFactory

public final class JaxoObjectFactory extends Object
Factory class to create instances of JaxoObjects.
Since:
2.0
  • Method Details

    • 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 in JaxoConstants).
      Returns:
      A new instance of a JaxoObject. Always non-null.
    • newObject

      public static JaxoObject newObject(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, Point[] location)
      Creates a new JaxoObject, initialized with values taken from the Preferences. A NoSuchElementException is thrown if type is not a known object.
      Parameters:
      type - The type of object to be created (defined in JaxoConstants).
      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, 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 in JaxoConstants).
      objectId - The class name of the object of the given type. This is used to instantiate the object.