/** * Get-or-create method for synthetic ids. * * @see #syntheticIds */ private <Q extends BaseProxy> SimpleProxyId<Q> allocateSyntheticId(String typeToken, int syntheticId) { @SuppressWarnings("unchecked") SimpleProxyId<Q> toReturn = (SimpleProxyId<Q>) state.syntheticIds.get(syntheticId); if (toReturn == null) { toReturn = state.requestFactory.allocateId(state.requestFactory.<Q> getTypeFromToken(typeToken)); state.syntheticIds.put(syntheticId, toReturn); } return toReturn; }
/** * Create a new object, with an ephemeral id. */ public <T extends BaseProxy> T create(Class<T> clazz) { checkLocked(); SimpleProxyId<T> id = state.requestFactory.allocateId(clazz); AutoBean<T> created = createProxy(clazz, id, false); return takeOwnership(created); }
public void processPayload(Receiver<Void> receiver, String payload) { Splittable raw = StringQuoter.split(payload); @SuppressWarnings("unchecked") Receiver<Object> callback = (Receiver<Object>) state.invocations.get(0).getReceiver(); if (!raw.isNull("error")) { Splittable error = raw.get("error"); ServerFailure failure = new ServerFailure(error.get("message").asString(), error.get("code").asString(), payload, true); fail(receiver, failure); return; } Splittable result = raw.get("result"); @SuppressWarnings("unchecked") Class<BaseProxy> target = (Class<BaseProxy>) state.invocations.get(0).getRequestData().getReturnType(); SimpleProxyId<BaseProxy> id = getRequestFactory().allocateId(target); AutoBean<BaseProxy> bean = createProxy(target, id, true); // XXX expose this as a proper API ((AbstractAutoBean<?>) bean).setData(result); // AutoBeanCodex.decodeInto(result, bean); if (callback != null) { callback.onSuccess(bean.as()); } if (receiver != null) { receiver.onSuccess(null); } }
/** * Get-or-create method for synthetic ids. * * @see #syntheticIds */ private <Q extends BaseProxy> SimpleProxyId<Q> allocateSyntheticId(String typeToken, int syntheticId) { @SuppressWarnings("unchecked") SimpleProxyId<Q> toReturn = (SimpleProxyId<Q>) state.syntheticIds.get(syntheticId); if (toReturn == null) { toReturn = state.requestFactory.allocateId(state.requestFactory.<Q> getTypeFromToken(typeToken)); state.syntheticIds.put(syntheticId, toReturn); } return toReturn; }
/** * Get-or-create method for synthetic ids. * * @see #syntheticIds */ private <Q extends BaseProxy> SimpleProxyId<Q> allocateSyntheticId(String typeToken, int syntheticId) { @SuppressWarnings("unchecked") SimpleProxyId<Q> toReturn = (SimpleProxyId<Q>) state.syntheticIds.get(syntheticId); if (toReturn == null) { toReturn = state.requestFactory.allocateId(state.requestFactory.<Q> getTypeFromToken(typeToken)); state.syntheticIds.put(syntheticId, toReturn); } return toReturn; }
/** * Get-or-create method for synthetic ids. * * @see #syntheticIds */ private <Q extends BaseProxy> SimpleProxyId<Q> allocateSyntheticId(String typeToken, int syntheticId) { @SuppressWarnings("unchecked") SimpleProxyId<Q> toReturn = (SimpleProxyId<Q>) state.syntheticIds.get(syntheticId); if (toReturn == null) { toReturn = state.requestFactory.allocateId(state.requestFactory.<Q> getTypeFromToken(typeToken)); state.syntheticIds.put(syntheticId, toReturn); } return toReturn; }
/** * Create a new object, with an ephemeral id. */ public <T extends BaseProxy> T create(Class<T> clazz) { checkLocked(); SimpleProxyId<T> id = state.requestFactory.allocateId(clazz); AutoBean<T> created = createProxy(clazz, id, false); return takeOwnership(created); }
/** * Create a new object, with an ephemeral id. */ public <T extends BaseProxy> T create(Class<T> clazz) { checkLocked(); SimpleProxyId<T> id = state.requestFactory.allocateId(clazz); AutoBean<T> created = createProxy(clazz, id, false); return takeOwnership(created); }
/** * Create a new object, with an ephemeral id. */ public <T extends BaseProxy> T create(Class<T> clazz) { checkLocked(); SimpleProxyId<T> id = state.requestFactory.allocateId(clazz); AutoBean<T> created = createProxy(clazz, id, false); return takeOwnership(created); }
public void processPayload(Receiver<Void> receiver, String payload) { Splittable raw = StringQuoter.split(payload); @SuppressWarnings("unchecked") Receiver<Object> callback = (Receiver<Object>) state.invocations.get(0).getReceiver(); if (!raw.isNull("error")) { Splittable error = raw.get("error"); ServerFailure failure = new ServerFailure(error.get("message").asString(), error.get("code").asString(), payload, true); fail(receiver, failure); return; } Splittable result = raw.get("result"); @SuppressWarnings("unchecked") Class<BaseProxy> target = (Class<BaseProxy>) state.invocations.get(0).getRequestData().getReturnType(); SimpleProxyId<BaseProxy> id = getRequestFactory().allocateId(target); AutoBean<BaseProxy> bean = createProxy(target, id, true); // XXX expose this as a proper API ((AbstractAutoBean<?>) bean).setData(result); // AutoBeanCodex.decodeInto(result, bean); if (callback != null) { callback.onSuccess(bean.as()); } if (receiver != null) { receiver.onSuccess(null); } }
public void processPayload(Receiver<Void> receiver, String payload) { Splittable raw = StringQuoter.split(payload); @SuppressWarnings("unchecked") Receiver<Object> callback = (Receiver<Object>) state.invocations.get(0).getReceiver(); if (!raw.isNull("error")) { Splittable error = raw.get("error"); ServerFailure failure = new ServerFailure(error.get("message").asString(), error.get("code").asString(), payload, true); fail(receiver, failure); return; } Splittable result = raw.get("result"); @SuppressWarnings("unchecked") Class<BaseProxy> target = (Class<BaseProxy>) state.invocations.get(0).getRequestData().getReturnType(); SimpleProxyId<BaseProxy> id = getRequestFactory().allocateId(target); AutoBean<BaseProxy> bean = createProxy(target, id, true); // XXX expose this as a proper API ((AbstractAutoBean<?>) bean).setData(result); // AutoBeanCodex.decodeInto(result, bean); if (callback != null) { callback.onSuccess(bean.as()); } if (receiver != null) { receiver.onSuccess(null); } }
public void processPayload(Receiver<Void> receiver, String payload) { Splittable raw = StringQuoter.split(payload); @SuppressWarnings("unchecked") Receiver<Object> callback = (Receiver<Object>) state.invocations.get(0).getReceiver(); if (!raw.isNull("error")) { Splittable error = raw.get("error"); ServerFailure failure = new ServerFailure(error.get("message").asString(), error.get("code").asString(), payload, true); fail(receiver, failure); return; } Splittable result = raw.get("result"); @SuppressWarnings("unchecked") Class<BaseProxy> target = (Class<BaseProxy>) state.invocations.get(0).getRequestData().getReturnType(); SimpleProxyId<BaseProxy> id = getRequestFactory().allocateId(target); AutoBean<BaseProxy> bean = createProxy(target, id, true); // XXX expose this as a proper API ((AbstractAutoBean<?>) bean).setData(result); // AutoBeanCodex.decodeInto(result, bean); if (callback != null) { callback.onSuccess(bean.as()); } if (receiver != null) { receiver.onSuccess(null); } }