@SuppressWarnings("unchecked") @Override public void modifying(ScalarEvent e) { FrozenLazyInitializerImpl declaring = FrozenLazyInitializerImpl.this; if (!declaring.disableTargetListener) { ObjectModelFactory<ObjectModel> omFactory = declaring.omFactory; LazyInitializer rawLazyInitializer = declaring.lazyInitializer; EventAttributeContext localAttributeContext = e.getAttributeContext(AttributeScope.LOCAL); if (rawLazyInitializer.isUninitialized() || omFactory.get(rawLazyInitializer.getImplementation()) != e.getSource()) { ((ObjectModel) e.getSource()).removeScalarListener(this); return; } localAttributeContext.addAttribute(AK_MODIFIYING_EXECUTED, true); if (e.getProperty() == declaring.objectModelMetadata.getEntityIdProperty()) { FrozenContext<Object> ctx = (FrozenContext<Object>) declaring.idFrozenContext; localAttributeContext.addAttribute(AK_FROZENCONTEXT, ctx); FrozenContext.suspendFreezing(ctx, declaring.owner); } ScalarListener scalarListener = declaring.scalarListener; if (scalarListener != null) { declaring.executeModifying(e.dispatch(declaring.omFactory.get(declaring.owner))); } } }
@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); } }
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); } }