/** * Allocates a single id from the allocator for the specified kind. Safe to use in concert * with the automatic generator. This is just a convenience method for allocateIds(). * * @param clazz must be a registered entity class with a Long or long id field. * @return a key with an id that is unique to the kind */ public <T> Key<T> allocateId(final Class<T> clazz) { return allocateIds(clazz, 1).iterator().next(); }
/** * Allocates a single id from the allocator for the specified kind. Safe to use in concert * with the automatic generator. This is just a convenience method for allocateIds(). * * Note that the id is only unique within the parent, not across the entire kind. * * @param parentKeyOrEntity must be a legitimate parent for the class type. It need not * point to an existent entity, but it must be the correct type for clazz. * @param clazz must be a registered entity class with a Long or long id field, and * a parent key of the correct type. * @return a key with a new id unique to the kind and parent */ public <T> Key<T> allocateId(final Object parentKeyOrEntity, final Class<T> clazz) { return allocateIds(parentKeyOrEntity, clazz, 1).iterator().next(); }
/** * Allocates a single id from the allocator for the specified kind. Safe to use in concert * with the automatic generator. This is just a convenience method for allocateIds(). * * @param clazz must be a registered entity class with a Long or long id field. */ public <T> long allocateId(Class<T> clazz) { return allocateIds(clazz, 1).iterator().next().getId(); }
/** * Allocates a single id from the allocator for the specified kind. Safe to use in concert * with the automatic generator. This is just a convenience method for allocateIds(). * * Note that the id is only unique within the parent, not across the entire kind. * * @param parentKeyOrEntity must be a legitimate parent for the class type. It need not * point to an existent entity, but it must be the correct type for clazz. * @param clazz must be a registered entity class with a Long or long id field, and * a parent key of the correct type. */ public <T> long allocateId(Object parentKeyOrEntity, Class<T> clazz) { return allocateIds(parentKeyOrEntity, clazz, 1).iterator().next().getId(); }