Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Spring Data Commons
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.data.mapping.model
Class BasicPersistentEntity<T,P extends PersistentProperty<P>>

    java.lang.Object
      org.springframework.data.mapping.model.BasicPersistentEntity<T,P>

All Implemented Interfaces:
  MutablePersistentEntity<T,P>, PersistentEntity<T,P>

    public class BasicPersistentEntity<T,P extends PersistentProperty<P>>

extends Object
implements MutablePersistentEntity<T,P>

Simple value object to capture information of `PersistentEntity`s.

Author:
  Jon Brisbin , Oliver Gierke

Constructor Summary
`BasicPersistentEntity(TypeInformation<T> information)` Creates a new `BasicPersistentEntity` from the given `TypeInformation`.
`BasicPersistentEntity(TypeInformation<T> information, Comparator<P> comparator)` Creates a new `BasicPersistentEntity` for the given `TypeInformation` and `Comparator`.

Method Summary
`void` | `addAssociation(Association<P> association)` Adds an `Association` to the entity.
`void` | `addPersistentProperty(P property)` Adds a `PersistentProperty` to the entity.
`void` | `doWithAssociations(AssociationHandler<P> handler)` Applies the given `AssociationHandler` to all `Association` contained in this `PersistentEntity`.
`void` | `doWithProperties(PropertyHandler<P> handler)` Applies the given `PropertyHandler` to all `PersistentProperty`s contained in this `PersistentEntity`.
`P` | `getIdProperty()` Returns the id property of the `PersistentEntity`.
`String` | `getName()` The entity name including any package prefix
`P` | `getPersistentProperty(String name)` Obtains a PersistentProperty instance by name.
`PreferredConstructor<T>` | `getPreferredConstructor()` Returns the `PreferredConstructor` to be used to instantiate objects of this `PersistentEntity`.
`Class<T>` | `getType()` Returns the resolved Java type of this entity.
`TypeInformation<T>` | `getTypeInformation()` Returns the `TypeInformation` backing this `PersistentEntity`.
`void` | `setIdProperty(P property)` Sets the id property for the entity.
`void` | `verify()` Callback method to trigger validation of the `PersistentEntity`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BasicPersistentEntity

    public BasicPersistentEntity(TypeInformation<T> information)

  Creates a new `BasicPersistentEntity` from the given `TypeInformation`.

  Parameters:
    `information` - must not be null.

### BasicPersistentEntity

    public BasicPersistentEntity(TypeInformation<T> information,
                                 Comparator<P> comparator)

  Creates a new `BasicPersistentEntity` for the given `TypeInformation` and `Comparator`. The given `Comparator` will be used to define the order of the `PersistentProperty` instances added to the entity.

  Parameters:
    `information` - must not be null
    `comparator` -

Method Detail

### getPreferredConstructor

    public PreferredConstructor<T> getPreferredConstructor()

  Description copied from interface: `PersistentEntity`
  Returns the `PreferredConstructor` to be used to instantiate objects of this `PersistentEntity`.

  Specified by:
    `getPreferredConstructor` in interface `PersistentEntity<T,P extends PersistentProperty<P>>`
  Returns:
    must never return null.

### getName

    public String getName()

  Description copied from interface: `PersistentEntity`
  The entity name including any package prefix

  Specified by:
    `getName` in interface `PersistentEntity<T,P extends PersistentProperty<P>>`
  Returns:
    must never return null

### getIdProperty

    public P getIdProperty()

  Description copied from interface: `PersistentEntity`
  Returns the id property of the `PersistentEntity`. Must never return null as a `PersistentEntity` instance must not be created if there is no id property.

  Specified by:
    `getIdProperty` in interface `PersistentEntity<T,P extends PersistentProperty<P>>`
  Returns:
    the id property of the `PersistentEntity`.

### setIdProperty

    public void setIdProperty(P property)

  Description copied from interface: `MutablePersistentEntity`
  Sets the id property for the entity.

  Specified by:
    `setIdProperty` in interface `MutablePersistentEntity<T,P extends PersistentProperty<P>>`

### addPersistentProperty

    public void addPersistentProperty(P property)

  Description copied from interface: `MutablePersistentEntity`
  Adds a `PersistentProperty` to the entity.

  Specified by:
    `addPersistentProperty` in interface `MutablePersistentEntity<T,P extends PersistentProperty<P>>`

### addAssociation

    public void addAssociation(Association<P> association)

  Description copied from interface: `MutablePersistentEntity`
  Adds an `Association` to the entity.

  Specified by:
    `addAssociation` in interface `MutablePersistentEntity<T,P extends PersistentProperty<P>>`

### getPersistentProperty

    public P getPersistentProperty(String name)

  Description copied from interface: `PersistentEntity`
  Obtains a PersistentProperty instance by name.

  Specified by:
    `getPersistentProperty` in interface `PersistentEntity<T,P extends PersistentProperty<P>>`
  Parameters:
    `name` - The name of the property
  Returns:
    The `PersistentProperty` or null if it doesn't exist

### getType

    public Class<T> getType()

  Description copied from interface: `PersistentEntity`
  Returns the resolved Java type of this entity.

  Specified by:
    `getType` in interface `PersistentEntity<T,P extends PersistentProperty<P>>`
  Returns:
    The underlying Java class for this entity

### getTypeInformation

    public TypeInformation<T> getTypeInformation()

  Description copied from interface: `PersistentEntity`
  Returns the `TypeInformation` backing this `PersistentEntity`.

  Specified by:
    `getTypeInformation` in interface `PersistentEntity<T,P extends PersistentProperty<P>>`
  Returns:

### doWithProperties

    public void doWithProperties(PropertyHandler<P> handler)

  Description copied from interface: `PersistentEntity`
  Applies the given `PropertyHandler` to all `PersistentProperty`s contained in this `PersistentEntity`.

  Specified by:
    `doWithProperties` in interface `PersistentEntity<T,P extends PersistentProperty<P>>`
  Parameters:
    `handler` - must not be null.

### doWithAssociations

    public void doWithAssociations(AssociationHandler<P> handler)

  Description copied from interface: `PersistentEntity`
  Applies the given `AssociationHandler` to all `Association` contained in this `PersistentEntity`.

  Specified by:
    `doWithAssociations` in interface `PersistentEntity<T,P extends PersistentProperty<P>>`
  Parameters:
    `handler` - must not be null.

### verify

    public void verify()

  Description copied from interface: `MutablePersistentEntity`
  Callback method to trigger validation of the `PersistentEntity`. As `MutablePersistentEntity` is not immutable there might be some verification steps necessary after the object has reached is final state.

  Specified by:
    `verify` in interface `MutablePersistentEntity<T,P extends PersistentProperty<P>>`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Spring Data Commons
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2011. All Rights Reserved.