本文整理汇总了Java中com.google.web.bindery.autobean.shared.AutoBean.setTag方法的典型用法代码示例。如果您正苦于以下问题:Java AutoBean.setTag方法的具体用法?Java AutoBean.setTag怎么用?Java AutoBean.setTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.web.bindery.autobean.shared.AutoBean
的用法示例。
在下文中一共展示了AutoBean.setTag方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: editProxy
import com.google.web.bindery.autobean.shared.AutoBean; //导入方法依赖的package包/类
/**
* Take ownership of a proxy instance and make it editable.
*/
public <T extends BaseProxy> T editProxy(final T object) {
AutoBean<T> bean = this.checkStreamsNotCrossed(object);
this.checkLocked();
@SuppressWarnings("unchecked")
final AutoBean<T> previouslySeen =
(AutoBean<T>) this.state.editedProxies.get(BaseProxyCategory.stableId(bean));
if (previouslySeen != null && !previouslySeen.isFrozen()) {
/*
* If we've seen the object before, it might be because it was passed in as a method argument.
* This does not guarantee its mutability, so check that here before returning the cached
* object.
*/
return previouslySeen.as();
}
// Create editable copies
final AutoBean<T> parent = bean;
bean = this.cloneBeanAndCollections(bean);
bean.setTag(Constants.PARENT_OBJECT, parent);
return bean.as();
}
示例2: createProxy
import com.google.web.bindery.autobean.shared.AutoBean; //导入方法依赖的package包/类
/**
* Creates a new proxy with an assigned ID.
*
* @param clazz The proxy type
* @param id The id to be assigned to the new proxy
* @param useAppendedContexts if {@code true} use the AutoBeanFactory types associated with any
* contexts that have been passed into {@link #append(RequestContext)}. If {@code false},
* this method will only create proxy types reachable from the implemented RequestContext
* interface.
* @throws IllegalArgumentException if the requested proxy type cannot be created
*/
protected <T extends BaseProxy> AutoBean<T> createProxy(final Class<T> clazz,
final SimpleProxyId<T> id, final boolean useAppendedContexts) {
AutoBean<T> created = null;
if (useAppendedContexts) {
for (final AbstractRequestContext ctx : this.state.appendedContexts) {
created = ctx.getAutoBeanFactory().create(clazz);
if (created != null) {
break;
}
}
} else {
created = this.getAutoBeanFactory().create(clazz);
}
if (created != null) {
created.setTag(STABLE_ID, id);
return created;
}
throw new IllegalArgumentException("Unknown proxy type " + clazz.getName());
}
示例3: makeImmutable
import com.google.web.bindery.autobean.shared.AutoBean; //导入方法依赖的package包/类
/**
* Make an EntityProxy immutable.
*/
private void makeImmutable(final AutoBean<? extends BaseProxy> toMutate) {
// Always diff'ed against itself, producing a no-op
toMutate.setTag(Constants.PARENT_OBJECT, toMutate);
// Act with entity-identity semantics
toMutate.setTag(REQUEST_CONTEXT_STATE, null);
toMutate.setFrozen(true);
}
示例4: takeOwnership
import com.google.web.bindery.autobean.shared.AutoBean; //导入方法依赖的package包/类
/**
* Make the EnityProxy bean edited and owned by this RequestContext.
*/
private <T extends BaseProxy> T takeOwnership(final AutoBean<T> bean) {
this.state.editedProxies.put(stableId(bean), bean);
bean.setTag(REQUEST_CONTEXT_STATE, this.state);
return bean.as();
}