org.springframework.data.jdbc.mybatis

## Class MyBatisContext

- java.lang.Object
- - org.springframework.data.jdbc.mybatis.MyBatisContext

    public class MyBatisContext
    extends Object

`MyBatisContext` instances get passed to MyBatis mapped statements as arguments, making Ids, instances, domainType and other attributes available to the statements. All methods might return null depending on the kind of values available on invocation.

Author:
  Jens Schauder, Christoph Strobl

### Constructor Summary

Constructors
Constructor and Description
`MyBatisContext(Identifier identifier, Object instance, Class<?> domainType)`
`MyBatisContext(Object id, Object instance, Class<?> domainType, Map<String,Object> additionalValues)`

### Method Summary

All Methods Instance Methods Concrete Methods
`Object` `get(String key)` Returns a value for the given key.
`Class` `getDomainType()` The domain type of the entity to query or act upon.
`Object` `getId()` The ID of the entity to query/act upon.
`Identifier` `getIdentifier()` The `Identifier` for a path to query.
`Object` `getInstance()` The entity to act upon.

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

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

### Constructor Detail

#### MyBatisContext

    public MyBatisContext(@Nullable
                          Object id,
                          @Nullable
                          Object instance,
                          @Nullable
                          Class<?> domainType,
                          Map<String,Object> additionalValues)

#### MyBatisContext

    public MyBatisContext(Identifier identifier,
                          @Nullable
                          Object instance,
                          @Nullable
                          Class<?> domainType)

### Method Detail

#### getId

    @Nullable
    public Object getId()

The ID of the entity to query/act upon.

Returns:
  Might return `null`.

#### getIdentifier

    @Nullable
    public Identifier getIdentifier()

The `Identifier` for a path to query.

Returns:
  Might return null.

#### getInstance

    @Nullable
    public Object getInstance()

The entity to act upon. This is `null` for queries, since the object doesn't exist before the query.

Returns:
  Might return `null`.

#### getDomainType

    @Nullable
    public Class getDomainType()

The domain type of the entity to query or act upon.

Returns:
  Might return `null`.

#### get

    @Nullable
    public Object get(String key)

Returns a value for the given key. Used to communicate ids of parent entities.

Parameters:
  `key` - Must not be `null`.
Returns:
  Might return `null`.