@Override
 public void modified(ScalarEvent e) {
   EventAttributeContext localAttributeContext = e.getAttributeContext(AttributeScope.LOCAL);
   if (localAttributeContext.getAttribute(AK_MODIFIYING_EXECUTED) == null) {
     return;
   }
   FrozenLazyInitializerImpl declaring = FrozenLazyInitializerImpl.this;
   if (e.getProperty() == declaring.objectModelMetadata.getEntityIdProperty()) {
     try {
       declaring.disableSetTargetIdentifier = true;
       try {
         declaring.setIdentifier((Serializable) e.getScalar(PropertyVersion.ATTACH));
       } finally {
         declaring.disableSetTargetIdentifier = false;
       }
     } finally {
       FrozenContext<?> ctx =
           (FrozenContext<?>) localAttributeContext.getAttribute(AK_FROZENCONTEXT);
       FrozenContext.resumeFreezing(ctx);
     }
   }
   ScalarEvent dispatchedEvent = e.getDispathcedEvent(true);
   if (dispatchedEvent != null) {
     declaring.executeModified(dispatchedEvent);
   }
 }
 @SuppressWarnings({"unchecked", "rawtypes"})
 @Override
 public void setIdentifier(Serializable id) {
   FrozenContext<Serializable> ctx = (FrozenContext) this.idFrozenContext;
   FrozenContext.suspendFreezing(ctx, this.owner);
   try {
     this.setRawIdentifier(id);
   } finally {
     FrozenContext.resumeFreezing(ctx);
   }
 }
Ejemplo n.º 3
0
  public void setFirstName(String firstName) {

    FrozenContext<FullName> ctx = this.firstNameFrozenContext;

    /*
     * Before modification, remove the current object from the all the
     * hash-tables and red-black-trees retained by this.firstNameFrozenContext
     */
    FrozenContext.suspendFreezing(ctx, this);
    try {
      this.firstName = firstName;
    } finally {
      /*
       * After modification, add the current object into the all the
       * hash-tables and red-black-trees retained by this.firstNameFrozenContext
       * AGAIN!
       */
      FrozenContext.resumeFreezing(ctx);
    }
  }