/** * Allocates an ephemeral proxy id. This object is only valid for the lifetime * of the RequestFactory. */ public <P extends BaseProxy> SimpleProxyId<P> allocateId(Class<P> clazz) { SimpleProxyId<P> toReturn = createId(clazz, ephemeralIds.size() + 1); ephemeralIds.put(getHistoryToken(toReturn), toReturn); return toReturn; }
/** * Allocates a synthetic proxy id. This object is only valid for the lifetime * of a request. */ public <P extends BaseProxy> SimpleProxyId<P> allocateSyntheticId( Class<P> clazz, int syntheticId) { assert syntheticId > 0; SimpleProxyId<P> toReturn = createId(clazz, "%" + syntheticId); toReturn.setSyntheticId(syntheticId); return toReturn; }
System.err.println(fact.createId());
public <P extends BaseProxy> SimpleProxyId<P> getBaseProxyId( String historyToken) { assert !IdUtil.isSynthetic(historyToken) : "Synthetic id resolution" + " should be handled by AbstractRequestContext"; if (IdUtil.isPersisted(historyToken)) { return getId(IdUtil.getTypeToken(historyToken), IdUtil.getServerId(historyToken)); } if (IdUtil.isEphemeral(historyToken)) { @SuppressWarnings("unchecked") SimpleProxyId<P> toReturn = (SimpleProxyId<P>) ephemeralIds.get(historyToken); /* * This is tested in FindServiceTest.testFetchUnpersistedFutureId. In * order to get here, the user would have to get an unpersisted history * token and attempt to use it with a different RequestFactory instance. * This could occur if an ephemeral token were bookmarked. In this case, * we'll create a token, however it will never match anything. */ if (toReturn == null) { Class<P> clazz = checkTypeToken(IdUtil.getTypeToken(historyToken)); toReturn = createId(clazz, -1 * ephemeralIds.size()); ephemeralIds.put(historyToken, toReturn); } return toReturn; } throw new IllegalArgumentException(historyToken); }
/** * Allocates a synthetic proxy id. This object is only valid for the lifetime * of a request. */ public <P extends BaseProxy> SimpleProxyId<P> allocateSyntheticId( Class<P> clazz, int syntheticId) { assert syntheticId > 0; SimpleProxyId<P> toReturn = createId(clazz, "%" + syntheticId); toReturn.setSyntheticId(syntheticId); return toReturn; }
/** * Allocates a synthetic proxy id. This object is only valid for the lifetime * of a request. */ public <P extends BaseProxy> SimpleProxyId<P> allocateSyntheticId( Class<P> clazz, int syntheticId) { assert syntheticId > 0; SimpleProxyId<P> toReturn = createId(clazz, "%" + syntheticId); toReturn.setSyntheticId(syntheticId); return toReturn; }
/** * Allocates an ephemeral proxy id. This object is only valid for the lifetime * of the RequestFactory. */ public <P extends BaseProxy> SimpleProxyId<P> allocateId(Class<P> clazz) { SimpleProxyId<P> toReturn = createId(clazz, ephemeralIds.size() + 1); ephemeralIds.put(getHistoryToken(toReturn), toReturn); return toReturn; }
/** * Allocates an ephemeral proxy id. This object is only valid for the lifetime * of the RequestFactory. */ public <P extends BaseProxy> SimpleProxyId<P> allocateId(Class<P> clazz) { SimpleProxyId<P> toReturn = createId(clazz, ephemeralIds.size() + 1); ephemeralIds.put(getHistoryToken(toReturn), toReturn); return toReturn; }
/** * Allocates an ephemeral proxy id. This object is only valid for the lifetime * of the RequestFactory. */ public <P extends BaseProxy> SimpleProxyId<P> allocateId(Class<P> clazz) { SimpleProxyId<P> toReturn = createId(clazz, ephemeralIds.size() + 1); ephemeralIds.put(getHistoryToken(toReturn), toReturn); return toReturn; }
/** * Allocates a synthetic proxy id. This object is only valid for the lifetime * of a request. */ public <P extends BaseProxy> SimpleProxyId<P> allocateSyntheticId( Class<P> clazz, int syntheticId) { assert syntheticId > 0; SimpleProxyId<P> toReturn = createId(clazz, "%" + syntheticId); toReturn.setSyntheticId(syntheticId); return toReturn; }
public <P extends BaseProxy> SimpleProxyId<P> getBaseProxyId( String historyToken) { assert !IdUtil.isSynthetic(historyToken) : "Synthetic id resolution" + " should be handled by AbstractRequestContext"; if (IdUtil.isPersisted(historyToken)) { return getId(IdUtil.getTypeToken(historyToken), IdUtil.getServerId(historyToken)); } if (IdUtil.isEphemeral(historyToken)) { @SuppressWarnings("unchecked") SimpleProxyId<P> toReturn = (SimpleProxyId<P>) ephemeralIds.get(historyToken); /* * This is tested in FindServiceTest.testFetchUnpersistedFutureId. In * order to get here, the user would have to get an unpersisted history * token and attempt to use it with a different RequestFactory instance. * This could occur if an ephemeral token were bookmarked. In this case, * we'll create a token, however it will never match anything. */ if (toReturn == null) { Class<P> clazz = checkTypeToken(IdUtil.getTypeToken(historyToken)); toReturn = createId(clazz, -1 * ephemeralIds.size()); ephemeralIds.put(historyToken, toReturn); } return toReturn; } throw new IllegalArgumentException(historyToken); }
public <P extends BaseProxy> SimpleProxyId<P> getBaseProxyId( String historyToken) { assert !IdUtil.isSynthetic(historyToken) : "Synthetic id resolution" + " should be handled by AbstractRequestContext"; if (IdUtil.isPersisted(historyToken)) { return getId(IdUtil.getTypeToken(historyToken), IdUtil.getServerId(historyToken)); } if (IdUtil.isEphemeral(historyToken)) { @SuppressWarnings("unchecked") SimpleProxyId<P> toReturn = (SimpleProxyId<P>) ephemeralIds.get(historyToken); /* * This is tested in FindServiceTest.testFetchUnpersistedFutureId. In * order to get here, the user would have to get an unpersisted history * token and attempt to use it with a different RequestFactory instance. * This could occur if an ephemeral token were bookmarked. In this case, * we'll create a token, however it will never match anything. */ if (toReturn == null) { Class<P> clazz = checkTypeToken(IdUtil.getTypeToken(historyToken)); toReturn = createId(clazz, -1 * ephemeralIds.size()); ephemeralIds.put(historyToken, toReturn); } return toReturn; } throw new IllegalArgumentException(historyToken); }
public <P extends BaseProxy> SimpleProxyId<P> getBaseProxyId( String historyToken) { assert !IdUtil.isSynthetic(historyToken) : "Synthetic id resolution" + " should be handled by AbstractRequestContext"; if (IdUtil.isPersisted(historyToken)) { return getId(IdUtil.getTypeToken(historyToken), IdUtil.getServerId(historyToken)); } if (IdUtil.isEphemeral(historyToken)) { @SuppressWarnings("unchecked") SimpleProxyId<P> toReturn = (SimpleProxyId<P>) ephemeralIds.get(historyToken); /* * This is tested in FindServiceTest.testFetchUnpersistedFutureId. In * order to get here, the user would have to get an unpersisted history * token and attempt to use it with a different RequestFactory instance. * This could occur if an ephemeral token were bookmarked. In this case, * we'll create a token, however it will never match anything. */ if (toReturn == null) { Class<P> clazz = checkTypeToken(IdUtil.getTypeToken(historyToken)); toReturn = createId(clazz, -1 * ephemeralIds.size()); ephemeralIds.put(historyToken, toReturn); } return toReturn; } throw new IllegalArgumentException(historyToken); }