本文整理汇总了Java中com.googlecode.objectify.annotation.OnSave类的典型用法代码示例。如果您正苦于以下问题:Java OnSave类的具体用法?Java OnSave怎么用?Java OnSave使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OnSave类属于com.googlecode.objectify.annotation包,在下文中一共展示了OnSave类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAuditableFieldsOnSave
import com.googlecode.objectify.annotation.OnSave; //导入依赖的package包/类
@OnSave
private void setAuditableFieldsOnSave() {
if (!skipSettingAuditableFields) {
updated = DateTime.now();
updatedBy = getCurrentUserRef();
if (created == null) {
created = updated;
createdBy = updatedBy;
}
}
}
示例2: disallowUnshardedSaves
import com.googlecode.objectify.annotation.OnSave; //导入依赖的package包/类
/** As a safety mechanism, fail if someone tries to save this class directly. */
@OnSave
void disallowUnshardedSaves() {
if (!isShard) {
throw new UnshardedSaveException();
}
}
示例3: onSave
import com.googlecode.objectify.annotation.OnSave; //导入依赖的package包/类
/**
* On save update the date added
*/
@OnSave
void onSave() {
if(this.dateAdded == null) {
this.dateAdded = new Date();
}
}
示例4: save
import com.googlecode.objectify.annotation.OnSave; //导入依赖的package包/类
@OnSave
public void save() {
onSaveCalled = true;
}
示例5: updateLastUpdateTimestamp
import com.googlecode.objectify.annotation.OnSave; //导入依赖的package包/类
@OnSave
public void updateLastUpdateTimestamp() {
this.setLastUpdate(new Date());
}
示例6: onPersist
import com.googlecode.objectify.annotation.OnSave; //导入依赖的package包/类
@OnSave
void onPersist() {
// TODO: Move this method to a superclass that implements a persistence layer
++this.version;
}
示例7: invalidateInCache
import com.googlecode.objectify.annotation.OnSave; //导入依赖的package包/类
/**
* Invalidates the cache entry.
*
* <p>This is called automatically when the registry is saved. One should also call it when a
* registry is deleted.
*/
@OnSave
public void invalidateInCache() {
CACHE.invalidate(tldStr);
}