- All Known Subinterfaces:
FluentEnvironment<X>,Knowledge,Rule,RuleBuilder<C>,RuleBuilder<C>,RuleDescriptor,RuleSession<S>,RuleSetContext<C,,R> RuntimeContext<C>,RuntimeRule,StatefulSession,StatelessSession
- All Known Implementing Classes:
AbstractRule,AbstractSessionWrapper,KnowledgeWrapper
public interface Environment
The Environment interface provides a way to store and retrieve property values.
It allows setting and getting properties with a specified name and value.
Additionally, it provides a method to retrieve all property names in the environment.
-
Method Summary
Modifier and TypeMethodDescription<T> TRetrieves the value of a property by its name.default <T> TRetrieves the value of a property by its name.Retrieves a collection of all property names in the environment.Sets a property in the environment with the specified name and value.
-
Method Details
-
set
Sets a property in the environment with the specified name and value.- Parameters:
property- The name of the property to be set.value- The value of the property to be set.- Returns:
- The previous value of the property, or
nullif it did not have one.
-
get
Retrieves the value of a property by its name.- Type Parameters:
T- The expected type of the property value.- Parameters:
property- The name of the property to retrieve.- Returns:
- The value of the property as type T, or
nullif it does not exist.
-
get
Retrieves the value of a property by its name. If the property does not exist, it returns a default value specified by the caller.- Type Parameters:
T- The expected type of the property value.- Parameters:
name- The name of the property to retrieve.defaultValue- The default value to return if the property does not exist.- Returns:
- The value of the property as type T, or the defaultValue if the property does not exist.
-
getPropertyNames
Collection<String> getPropertyNames()Retrieves a collection of all property names in the environment.- Returns:
- A collection of strings representing all property names in the environment.
-