public ProxySerializer getSerializer(ProxyStore store) { return new ProxySerializerImpl(this, store); }
private <T extends BaseProxy> T doDeserialize(SimpleProxyId<T> id) { try { return getProxyForReturnPayloadGraph(id).as(); } catch (NoDataException e) { return null; } finally { clear(); } }
public <T extends BaseProxy> T deserialize(Class<T> proxyType, String key) { // Fast exit to prevent getOperation from throwing an exception if (store.get(key) == null) { return null; } OperationMessage op = getOperation(key); @SuppressWarnings("unchecked") SimpleProxyId<T> id = (SimpleProxyId<T>) getId(op); return doDeserialize(id); }
@Override public void endVisitCollectionProperty(String propertyName, AutoBean<Collection<?>> value, CollectionPropertyContext ctx) { if (value == null) { return; } if (isEntityType(ctx.getElementType()) || isValueType(ctx.getElementType())) { for (Object o : value.as()) { serialize((BaseProxy) o); } } }
private void serializeOneProxy(SimpleProxyId<?> idForSerialization, AutoBean<? extends BaseProxy> bean) { AutoBean<OperationMessage> op = makeOperationMessage(serializedId(BaseProxyCategory.stableId(bean)), bean, false); store.put(getRequestFactory().getHistoryToken(idForSerialization), AutoBeanCodex.encode(op)); } }
@Override <Q extends BaseProxy> AutoBean<Q> getProxyForReturnPayloadGraph(SimpleProxyId<Q> id) { AutoBean<Q> toReturn = super.getProxyForReturnPayloadGraph(id); if (restored.add(id)) { /* * If we haven't seen the id before, use the data in the OperationMessage * to repopulate the properties of the canonical bean for this id. */ OperationMessage op = getOperation(getRequestFactory().getHistoryToken(id)); this.processReturnOperation(id, op); toReturn.setTag(Constants.STABLE_ID, super.getId(op)); } return toReturn; }
final SimpleProxyId<?> id = serializedId(BaseProxyCategory.stableId(root)); if (previous == null || !previous.isFrozen()) { serialized.put(id, root); serializeOneProxy(id, root); root.accept(new AutoBeanVisitor() { @Override return getRequestFactory().getHistoryToken(id);
@Override protected AutoBeanFactory getAutoBeanFactory() { return getRequestFactory().getAutoBeanFactory(); }
public <T extends EntityProxy> T deserialize(EntityProxyId<T> id) { return doDeserialize((SimpleEntityProxyId<T>) id); }
@Override public void endVisit(AutoBean<?> bean, Context ctx) { // Avoid unnecessary method call if (bean == root) { return; } if (isEntityType(bean.getType()) || isValueType(bean.getType())) { serialize((BaseProxy) bean.as()); } }
private void serializeOneProxy(SimpleProxyId<?> idForSerialization, AutoBean<? extends BaseProxy> bean) { AutoBean<OperationMessage> op = makeOperationMessage(serializedId(BaseProxyCategory.stableId(bean)), bean, false); store.put(getRequestFactory().getHistoryToken(idForSerialization), AutoBeanCodex.encode(op)); } }
@Override <Q extends BaseProxy> AutoBean<Q> getProxyForReturnPayloadGraph(SimpleProxyId<Q> id) { AutoBean<Q> toReturn = super.getProxyForReturnPayloadGraph(id); if (restored.add(id)) { /* * If we haven't seen the id before, use the data in the OperationMessage * to repopulate the properties of the canonical bean for this id. */ OperationMessage op = getOperation(getRequestFactory().getHistoryToken(id)); this.processReturnOperation(id, op); toReturn.setTag(Constants.STABLE_ID, super.getId(op)); } return toReturn; }
final SimpleProxyId<?> id = serializedId(BaseProxyCategory.stableId(root)); if (previous == null || !previous.isFrozen()) { serialized.put(id, root); serializeOneProxy(id, root); root.accept(new AutoBeanVisitor() { @Override return getRequestFactory().getHistoryToken(id);
@Override SimpleProxyId<BaseProxy> getId(IdMessage op) { if (Strength.SYNTHETIC.equals(op.getStrength())) { return getRequestFactory().allocateSyntheticId( getRequestFactory().getTypeFromToken(op.getTypeToken()), op.getSyntheticId()); } return super.getId(op); }
public <T extends EntityProxy> T deserialize(EntityProxyId<T> id) { return doDeserialize((SimpleEntityProxyId<T>) id); }
@Override public void endVisitMapProperty(String propertyName, AutoBean<Map<?, ?>> value, MapPropertyContext ctx) { if (value == null) { return; } for (Map.Entry<?, ?> entry : value.as().entrySet()) { if (isEntityType(ctx.getKeyType()) || isValueType(ctx.getKeyType())) { serialize((BaseProxy) entry.getKey()); } if (isEntityType(ctx.getValueType()) || isValueType(ctx.getValueType())) { serialize((BaseProxy) entry.getValue()); } } } });
public <T extends BaseProxy> T deserialize(Class<T> proxyType, String key) { // Fast exit to prevent getOperation from throwing an exception if (store.get(key) == null) { return null; } OperationMessage op = getOperation(key); @SuppressWarnings("unchecked") SimpleProxyId<T> id = (SimpleProxyId<T>) getId(op); return doDeserialize(id); }
private void serializeOneProxy(SimpleProxyId<?> idForSerialization, AutoBean<? extends BaseProxy> bean) { AutoBean<OperationMessage> op = makeOperationMessage(serializedId(BaseProxyCategory.stableId(bean)), bean, false); store.put(getRequestFactory().getHistoryToken(idForSerialization), AutoBeanCodex.encode(op)); } }
@Override <Q extends BaseProxy> AutoBean<Q> getProxyForReturnPayloadGraph(SimpleProxyId<Q> id) { AutoBean<Q> toReturn = super.getProxyForReturnPayloadGraph(id); if (restored.add(id)) { /* * If we haven't seen the id before, use the data in the OperationMessage * to repopulate the properties of the canonical bean for this id. */ OperationMessage op = getOperation(getRequestFactory().getHistoryToken(id)); this.processReturnOperation(id, op); toReturn.setTag(Constants.STABLE_ID, super.getId(op)); } return toReturn; }
final SimpleProxyId<?> id = serializedId(BaseProxyCategory.stableId(root)); if (previous == null || !previous.isFrozen()) { serialized.put(id, root); serializeOneProxy(id, root); root.accept(new AutoBeanVisitor() { @Override return getRequestFactory().getHistoryToken(id);