public class PriorityContextResolver
extends java.lang.Object
implements io.flamingock.internal.common.core.context.ContextResolver
ContextResolver that prioritizes resolution from one context over another.
It delegates to a "priority" context first, and falls back to a "base" context if the dependency or property is not found in the first.
| Constructor and Description |
|---|
PriorityContextResolver(io.flamingock.internal.common.core.context.ContextResolver priorityContext,
io.flamingock.internal.common.core.context.ContextResolver baseContext)
Creates a composite dependency context where the given priority context takes precedence
over the base context during resolution.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Optional<io.flamingock.internal.common.core.context.Dependency> |
getDependency(java.lang.Class<?> type)
Retrieves a dependency by type, prioritizing the
priorityContext over the baseContext. |
java.util.Optional<io.flamingock.internal.common.core.context.Dependency> |
getDependency(java.lang.String name)
Retrieves a dependency by name, prioritizing the
priorityContext over the baseContext. |
java.util.Optional<java.lang.String> |
getProperty(java.lang.String key)
Retrieves a string property by key, resolving it from the merged dependency contexts.
|
<T> java.util.Optional<T> |
getPropertyAs(java.lang.String key,
java.lang.Class<T> type)
Retrieves a typed property by key, resolving it from the merged dependency contexts.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic PriorityContextResolver(io.flamingock.internal.common.core.context.ContextResolver priorityContext,
io.flamingock.internal.common.core.context.ContextResolver baseContext)
priorityContext - the preferred context to check firstbaseContext - the fallback context used if the dependency is not found in the priority contextpublic java.util.Optional<io.flamingock.internal.common.core.context.Dependency> getDependency(java.lang.Class<?> type)
priorityContext over the baseContext.getDependency in interface io.flamingock.internal.common.core.context.DependencyResolvertype - the class type of the dependencyOptional containing the dependency if found, otherwise emptypublic java.util.Optional<io.flamingock.internal.common.core.context.Dependency> getDependency(java.lang.String name)
priorityContext over the baseContext.getDependency in interface io.flamingock.internal.common.core.context.DependencyResolvername - the name of the dependencyOptional containing the dependency if found, otherwise emptypublic java.util.Optional<java.lang.String> getProperty(java.lang.String key)
getDependencyValue(key, String.class).getProperty in interface io.flamingock.internal.common.core.context.PropertyResolverkey - the property keyOptional containing the property value if present, otherwise emptypublic <T> java.util.Optional<T> getPropertyAs(java.lang.String key,
java.lang.Class<T> type)
getDependencyValue(key, type).getPropertyAs in interface io.flamingock.internal.common.core.context.PropertyResolverT - the type of the returned valuekey - the property keytype - the target typeOptional containing the converted value if present, otherwise empty