Class ConnectorShapeFactory
java.lang.Object
org.pathvisio.libgpml.model.connector.ConnectorShapeFactory
public abstract class ConnectorShapeFactory
extends java.lang.Object
Constructs connector shapes. This class allows you to register a custom
connector shape class. The class to register must have a public constructor
without arguments!
- Author:
- thomas
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Map<java.lang.String,java.lang.Class<? extends ConnectorShape>>shapes -
Constructor Summary
Constructors Constructor Description ConnectorShapeFactory() -
Method Summary
Modifier and Type Method Description static ConnectorShapecreateConnectorShape(java.lang.String name)Creates an instance of a the implementor of ConnectorShape identified by the given name.static java.lang.Class<? extends ConnectorShape>getImplementingClass(java.lang.String name)Returns the class that implements ConnectorShape identified by the given namestatic voidregisterShape(java.lang.String name, java.lang.Class<? extends ConnectorShape> shapeClass)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
shapes
-
-
Constructor Details
-
ConnectorShapeFactory
public ConnectorShapeFactory()
-
-
Method Details
-
registerShape
public static void registerShape(java.lang.String name, java.lang.Class<? extends ConnectorShape> shapeClass) -
createConnectorShape
Creates an instance of a the implementor of ConnectorShape identified by the given name.- Parameters:
name- the name of the connector shape- Returns:
- shape the connector shape, or the shape for
ConnectorType.STRAIGHTwhen a shape by the given name could not be found.
-
getImplementingClass
public static java.lang.Class<? extends ConnectorShape> getImplementingClass(java.lang.String name)Returns the class that implements ConnectorShape identified by the given name- Parameters:
name- the string.- Returns:
- the class, or null if no class is registered by the given name
-