Package com.github.devmix.process.acto
Interface ActiveObjectDependency
public interface ActiveObjectDependency
Represents a dependency between active objects.
- Author:
- Sergey Grachev
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumEnumerates the types of relationships that can exist between active objects. -
Method Summary
Modifier and TypeMethodDescriptionActiveObject<?> Ensures that the object is resolved and returns it.Returns the last error message that occurred during the resolution process, or an empty string if no errors have occurred.ActiveObject<?> Returns the object if it has already been resolved, or null otherwise.getType()Returns the type of dependency relationship.voidifResolved(java.util.function.Consumer<ActiveObject<?>> action) Executes the provided action if and when the object is resolved.booleanIndicates whether this dependency is optional.booleanChecks whether the object has been resolved and is available for use.
-
Method Details
-
ensureObject
ActiveObject<?> ensureObject()Ensures that the object is resolved and returns it. Otherwise, this method will throw a NullPointerException if the object is not yet resolved.- Returns:
- The resolved
ActiveObject. - Throws:
NullPointerException- if the object has not been resolved yet
-
getObject
Returns the object if it has already been resolved, or null otherwise.- Returns:
- The resolved
ActiveObject, or null if not yet resolved.
-
getLastError
String getLastError()Returns the last error message that occurred during the resolution process, or an empty string if no errors have occurred.- Returns:
- The last error message, or an empty string if no errors have occurred.
-
getType
ActiveObjectDependency.Type getType()Returns the type of dependency relationship.- Returns:
- The
ActiveObjectDependency.Typeof this dependency.
-
ifResolved
Executes the provided action if and when the object is resolved. If the object is already resolved, the action will be executed immediately. Otherwise, it will be queued for execution once resolution occurs.- Parameters:
action- TheConsumerto execute with the resolvedActiveObject.
-
isOptional
boolean isOptional()Indicates whether this dependency is optional. An optional dependency can be unresolved without causing an error.- Returns:
- True if this dependency is optional, false otherwise.
-
isResolved
boolean isResolved()Checks whether the object has been resolved and is available for use.- Returns:
- True if the object is resolved, false otherwise.
-