com.opensymphony.xwork2.mock

## Class MockObjectTypeDeterminer

- java.lang.Object
- - com.opensymphony.xwork2.mock.MockObjectTypeDeterminer

- All Implemented Interfaces:
    ObjectTypeDeterminer

      public class MockObjectTypeDeterminer
      extends Object
      implements ObjectTypeDeterminer

  Mocks the function of an ObjectTypeDeterminer for testing purposes.
  Author:
    Gabe

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MockObjectTypeDeterminer()`
    `MockObjectTypeDeterminer(Class keyClass, Class elementClass, String keyProperty, boolean shouldCreateIfNew)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Class` | `getElementClass()`
    `Class` | `getElementClass(Class parentClass, String property, Object key)`
    `Class` | `getKeyClass()`
    `Class` | `getKeyClass(Class parentClass, String property)`
    `String` | `getKeyProperty()`
    `String` | `getKeyProperty(Class parentClass, String property)`
    `boolean` | `isShouldCreateIfNew()`
    `void` | `setElementClass(Class elementClass)`
    `void` | `setKeyClass(Class keyClass)`
    `void` | `setKeyProperty(String keyProperty)`
    `void` | `setShouldCreateIfNew(boolean shouldCreateIfNew)`
    `boolean` | `shouldCreateIfNew(Class parentClass, String property, Object target, String keyProperty, boolean isIndexAccessed)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MockObjectTypeDeterminer

          public MockObjectTypeDeterminer()

    - #### MockObjectTypeDeterminer

          public MockObjectTypeDeterminer(Class keyClass,
                                          Class elementClass,
                                          String keyProperty,
                                          boolean shouldCreateIfNew)

      Parameters:
        `keyClass` - key class
        `elementClass` - element class
        `keyProperty` - key property
        `shouldCreateIfNew` - create if new

  - ### Method Detail

    - #### getKeyClass

          public Class getKeyClass(Class parentClass,
                                   String property)

      Specified by:
        `getKeyClass` in interface `ObjectTypeDeterminer`

    - #### getElementClass

          public Class getElementClass(Class parentClass,
                                       String property,
                                       Object key)

      Specified by:
        `getElementClass` in interface `ObjectTypeDeterminer`

    - #### getKeyProperty

          public String getKeyProperty(Class parentClass,
                                       String property)

      Specified by:
        `getKeyProperty` in interface `ObjectTypeDeterminer`

    - #### shouldCreateIfNew

          public boolean shouldCreateIfNew(Class parentClass,
                                           String property,
                                           Object target,
                                           String keyProperty,
                                           boolean isIndexAccessed)

      Specified by:
        `shouldCreateIfNew` in interface `ObjectTypeDeterminer`

    - #### getElementClass

          public Class getElementClass()

      Returns:
        Returns the elementClass.

    - #### setElementClass

          public void setElementClass(Class elementClass)

      Parameters:
        `elementClass` - The elementClass to set.

    - #### getKeyClass

          public Class getKeyClass()

      Returns:
        Returns the keyClass.

    - #### setKeyClass

          public void setKeyClass(Class keyClass)

      Parameters:
        `keyClass` - The keyClass to set.

    - #### getKeyProperty

          public String getKeyProperty()

      Returns:
        Returns the keyProperty.

    - #### setKeyProperty

          public void setKeyProperty(String keyProperty)

      Parameters:
        `keyProperty` - The keyProperty to set.

    - #### isShouldCreateIfNew

          public boolean isShouldCreateIfNew()

      Returns:
        Returns the shouldCreateIfNew.

    - #### setShouldCreateIfNew

          public void setShouldCreateIfNew(boolean shouldCreateIfNew)

      Parameters:
        `shouldCreateIfNew` - The shouldCreateIfNew to set.

Copyright © 2000–2025 Apache Software Foundation. All rights reserved.