@SuppressWarnings("unchecked") @Override public <T> T getEntityForId(Class<T> type, Serializable id) { if (packStopTimes && type.equals(StopTime.class)) { return (T) stopTimes.get((Integer) id); } else if (packShapePoints && type.equals(ShapePoint.class)) { return (T) shapePoints.get((Integer) id); } return super.getEntityForId(type, id); }
@SuppressWarnings("unchecked") @Override public <T> T getEntityForId(Class<T> type, Serializable id) { if (packStopTimes && type.equals(StopTime.class)) { return (T) stopTimes.get((Integer) id); } else if (packShapePoints && type.equals(ShapePoint.class)) { return (T) shapePoints.get((Integer) id); } return super.getEntityForId(type, id); }
@Override public void saveOrUpdateEntity(Object entity) { @SuppressWarnings("unchecked") IdentityBean<Serializable> bean = ((IdentityBean<Serializable>) entity); Object existing = getEntityForId(entity.getClass(), bean.getId()); // If the entity has already been inserted into storage, then we don't need // to save it if (existing == entity) return; saveEntity(entity); }
@Override public void saveOrUpdateEntity(Object entity) { @SuppressWarnings("unchecked") IdentityBean<Serializable> bean = ((IdentityBean<Serializable>) entity); Object existing = getEntityForId(entity.getClass(), bean.getId()); // If the entity has already been inserted into storage, then we don't need // to save it if (existing == entity) return; saveEntity(entity); }