org.apache.cayenne.map.event

## Class EntityEvent

- java.lang.Object
- - java.util.EventObject
  - - org.apache.cayenne.event.CayenneEvent
    - - org.apache.cayenne.map.event.MapEvent
      - - org.apache.cayenne.map.event.EntityEvent

- All Implemented Interfaces:
    Serializable
  Direct Known Subclasses:
    AttributeEvent, RelationshipEvent

      public class EntityEvent
      extends MapEvent

  Represents events resulted from Entity changes in CayenneModeler. This event is used for both ObjEntities and DbEntities.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Entity` | `entity`

    - ### Fields inherited from class org.apache.cayenne.map.event.MapEvent

      `ADD, CHANGE, domain, id, oldName, oldNameSet, REMOVE`

    - ### Fields inherited from class org.apache.cayenne.event.CayenneEvent

      `info, postedBy, subject`

    - ### Fields inherited from class java.util.EventObject

      `source`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `EntityEvent(Object src, Entity entity)` Creates a Entity change event.
    `EntityEvent(Object src, Entity entity, int id)` Creates a Entity event of a specified type.
    `EntityEvent(Object src, Entity entity, String oldName)` Creates a Entity name change event.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Entity` | `getEntity()` Returns entity object associated with this event.
    `String` | `getNewName()` Returns the newName of the object that caused this event.
    `void` | `setEntity(Entity entity)` Sets the entity.

    - ### Methods inherited from class org.apache.cayenne.map.event.MapEvent

      `getDomain, getId, getOldName, isNameChange, setDomain, setId, setOldName`

    - ### Methods inherited from class org.apache.cayenne.event.CayenneEvent

      `getInfo, getPostedBy, getSubject, setPostedBy, setSubject`

    - ### Methods inherited from class java.util.EventObject

      `getSource, toString`

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

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

- - ### Field Detail

    - #### entity

          protected Entity entity

  - ### Constructor Detail

    - #### EntityEvent

          public EntityEvent(Object src,
                             Entity entity)

      Creates a Entity change event.

    - #### EntityEvent

          public EntityEvent(Object src,
                             Entity entity,
                             int id)

      Creates a Entity event of a specified type.

    - #### EntityEvent

          public EntityEvent(Object src,
                             Entity entity,
                             String oldName)

      Creates a Entity name change event.

  - ### Method Detail

    - #### getEntity

          public Entity getEntity()

      Returns entity object associated with this event.

    - #### setEntity

          public void setEntity(Entity entity)

      Sets the entity.
      Parameters:
        `entity` - The entity to set

    - #### getNewName

          public String getNewName()

      Description copied from class: `MapEvent`
      Returns the newName of the object that caused this event.
      Specified by:
        `getNewName` in class `MapEvent`

Copyright © 2001–2023 Apache Cayenne. All rights reserved.