Interface RealmManagement
public interface RealmManagement
Low-level realm management functionality.
Realm IDs must conform to the following constraints:
- Must not start or end with whitespaces.
- Must only consist of US-ASCII letters or digits or hyphens (
-) or underscores (_). - Must not start with two consecutive colons (
::). - Must not be empty.
- Must not be longer than 128 characters.
Note: In a CDI container RealmManagement can be directly injected.
-
Method Summary
Modifier and TypeMethodDescription@NonNull RealmDefinitionCreates a new realm in created status with the given realm ID.voiddelete(@NonNull RealmDefinition expected) Deletes the given realm.@NonNull Optional<RealmDefinition> Retrieve a realm definition by realm ID.@NonNull Stream<RealmDefinition> list()Returns a stream of all realm definitions.@NonNull RealmDefinitionupdate(@NonNull RealmDefinition expected, @NonNull RealmDefinition update) Updates a realm definition toupdate, if the persisted state matches theexpectedstate, and if the status transition is valid.
-
Method Details
-
create
Creates a new realm in created status with the given realm ID.- Returns:
- the persisted state of the realm definition
- Throws:
RealmAlreadyExistsException- if a realm with the given ID already exists
-
list
Returns a stream of all realm definitions. The returned stream must be closed. -
get
Retrieve a realm definition by realm ID.- Returns:
- the realm definition if it exists.
-
update
Updates a realm definition toupdate, if the persisted state matches theexpectedstate, and if the status transition is valid.- Parameters:
expected- The expected persisted state of the realm definition. This must exactly represent the persisted realm definition as returned bycreate(String)orget(String)or a priorupdate(RealmDefinition, RealmDefinition).update- the new state of the realm definition to be persisted, thecreatedandupdatedattributes are solely managed by the implementation.- Returns:
- the persisted state of the realm definition
- Throws:
RealmNotFoundException- if a realm with the given ID does not existRealmExpectedStateMismatchException- if the expected state does not matchIllegalArgumentException- if the transition is not valid.
-
delete
Deletes the given realm.- Parameters:
expected- The expected persisted state of the realm definition. This must exactly represent the persisted realm definition as returned bycreate(String)orget(String)orupdate(RealmDefinition, RealmDefinition).- Throws:
RealmNotFoundException- if a realm with the given ID does not existRealmExpectedStateMismatchException- if the expected state does not match
-