org.mockcentral.editor.nodes.mockobject_group
Class MockObjectGroupModel

java.lang.Object
  extended by org.mockcentral.editor.nodes.MockCentralNodeModel
      extended by org.mockcentral.editor.nodes.MockCentralGroupNodeModel
          extended by org.mockcentral.editor.nodes.mockobject_group.MockObjectGroupModel

public class MockObjectGroupModel
extends MockCentralGroupNodeModel

A class that models the list of Mock Objects defined in a Fixture.

Author:
David Hutchinson

Field Summary
 
Fields inherited from class org.mockcentral.editor.nodes.MockCentralGroupNodeModel
observers
 
Fields inherited from class org.mockcentral.editor.nodes.MockCentralNodeModel
element, node
 
Constructor Summary
MockObjectGroupModel(MockCentralNode node)
          Creates a new instance.
 
Method Summary
 java.lang.String getChildNodeTypeDescription(boolean singular)
          Returns a String description of the MockCentralNode's child type, ie "Fixture", "Mock Object" etc.
 MockCentralTableModel<MockCentralNode> getClonableMockObjectsListModel()
          Returns the MockCentralTableModel for the list of Mock Objects available for cloning.
 java.lang.String getFirstReferencingMockObjectName(MockObjectNode mockObjectNode)
          Returns the name of the the first found Mock Object within the Fixture that references (as a method parameter or result) the one defined by the supplied MockObjectNode, if any.
 MockObjectModel getMockObjectModel(java.lang.String mockObjectName)
          Returns the MockObjectModel for the Mock Object identified by the parameter.
 boolean isDuplicateJndiName(java.lang.String jndiName, java.lang.Object o)
          Returns whether an new or edited Mock Object JNDI name is already in use.
 boolean isDuplicateMockObjectName(java.lang.String mockObjectName, int elementHashCode)
          Returns whether the supplied Mock Object name is in use for a Mock Object not identified by the supplied hashcode.
 
Methods inherited from class org.mockcentral.editor.nodes.MockCentralGroupNodeModel
addChildNode, addObserver, editSelectedChild, fireChildrenChanged, getChildren, getElement, loadElementData, removeChildNode, sortChildren
 
Methods inherited from class org.mockcentral.editor.nodes.MockCentralNodeModel
addObserver, getEnclosingFixtureNode, getNode, getNotRemovableMessage, getObservers, registerChanges, removeObserver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockObjectGroupModel

public MockObjectGroupModel(MockCentralNode node)
Creates a new instance.

Parameters:
node - the MockCentralNode containing the JDOM Element whose data this class models.
Method Detail

getClonableMockObjectsListModel

public MockCentralTableModel<MockCentralNode> getClonableMockObjectsListModel()
Returns the MockCentralTableModel for the list of Mock Objects available for cloning.

Returns:
the MockCentralTableModel for the list of Mock Objects available for cloning.

getChildNodeTypeDescription

public java.lang.String getChildNodeTypeDescription(boolean singular)
Description copied from class: MockCentralGroupNodeModel
Returns a String description of the MockCentralNode's child type, ie "Fixture", "Mock Object" etc.

Specified by:
getChildNodeTypeDescription in class MockCentralGroupNodeModel
Parameters:
singular - value for whether the String should be in singular form.
Returns:
a String description of the MockCentralNode type.

getMockObjectModel

public MockObjectModel getMockObjectModel(java.lang.String mockObjectName)
Returns the MockObjectModel for the Mock Object identified by the parameter.

Parameters:
mockObjectName - the name of the Mock Object.
Returns:
the MockObjectModel for the Mock Object identified by the parameter.

isDuplicateMockObjectName

public boolean isDuplicateMockObjectName(java.lang.String mockObjectName,
                                         int elementHashCode)
Returns whether the supplied Mock Object name is in use for a Mock Object not identified by the supplied hashcode.

Parameters:
mockObjectName - the proposed Mock Object name.
elementHashCode - the hashcode of the jdom element identifying the Mock Object being edited so it can be excluded from duplicate name testing.
Returns:
whether the supplied Mock Object name is in use for a Mock Object not identified by the supplied hashcode.

isDuplicateJndiName

public boolean isDuplicateJndiName(java.lang.String jndiName,
                                   java.lang.Object o)
Returns whether an new or edited Mock Object JNDI name is already in use.

Parameters:
jndiName - the new or edited Mock Object JNDI name.
o - the Object to test for eqivalency to any currently defined Mock Object.
Returns:
whether the JNDI name is already in use.

getFirstReferencingMockObjectName

public java.lang.String getFirstReferencingMockObjectName(MockObjectNode mockObjectNode)
Returns the name of the the first found Mock Object within the Fixture that references (as a method parameter or result) the one defined by the supplied MockObjectNode, if any.

Parameters:
mockObjectNode - the MockObjectNode defining the Mock Object to test.
Returns:
the name of the the first found Mock Object within the Fixture that references (as a method parameter or result) the one defined by the supplied MockObjectNode, if any.