Class EndpointBddTrait
java.lang.Object
software.amazon.smithy.model.traits.AbstractTrait
software.amazon.smithy.rulesengine.traits.EndpointBddTrait
- All Implemented Interfaces:
FromSourceLocation,ToNode,ToShapeId,Trait,ToSmithyBuilder<EndpointBddTrait>
public final class EndpointBddTrait
extends AbstractTrait
implements ToSmithyBuilder<EndpointBddTrait>
Trait containing a precompiled BDD with full context for endpoint resolution.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder for BddTrait.static final class -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic EndpointBddTrait.Builderbuilder()Creates a new builder for BddTrait.protected NodeThe result of toNode is used for hashCodes and equality.static EndpointBddTraitCreates a BddTrait from a control flow graph.static EndpointBddTraitCreates a BddTrait from a Node representation.static EndpointBddTraitfromNode(Node node, ClassLoader classLoader) Creates a BddTrait from a Node representation, discovering endpoint functions and built-ins using the givenclassLoader.getBdd()Gets the BDD structure.Gets theEndpointComponentFactoryused to resolve this BDD's functions, built-ins, and auth-scheme validators.Gets the ordered list of conditions.Gets the parameters for the endpoint rules.Gets the ordered list of results.Get the endpoint ruleset version.Removes conditions that are not referenced by any BDD node and remaps indices.Take this object and create a builder that contains all of the current property values of this object.transform(Function<EndpointBddTrait, EndpointBddTrait> transformer) Transform this BDD using the given function and return the updated BddTrait.Methods inherited from class software.amazon.smithy.model.traits.AbstractTrait
equals, getSourceLocation, hashCode, setNodeCache, toNode, toShapeId, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.smithy.model.traits.Trait
isSynthetic
-
Field Details
-
ID
-
-
Method Details
-
from
Creates a BddTrait from a control flow graph.- Parameters:
cfg- the control flow graph to compile- Returns:
- the BddTrait containing the compiled BDD and all context
-
removeUnreferencedConditions
Removes conditions that are not referenced by any BDD node and remaps indices.This should be called after all BDD optimizations (sifting, cost optimization) are complete. A condition could become unreferenced if it is optimized away by the BDD compiler because hi==lo.
- Returns:
- a new trait with unreferenced conditions removed, or this trait if none were removed
-
getParameters
Gets the parameters for the endpoint rules.- Returns:
- the parameters
-
getConditions
Gets the ordered list of conditions.- Returns:
- the conditions in evaluation order
-
getResults
Gets the ordered list of results.- Returns:
- the results (index 0 is always NoMatchRule)
-
getBdd
Gets the BDD structure.- Returns:
- the BDD
-
getVersion
Get the endpoint ruleset version.- Returns:
- the rules engine version
-
getComponentFactory
Gets theEndpointComponentFactoryused to resolve this BDD's functions, built-ins, and auth-scheme validators.Built lazily from the classloader captured when this trait was created (the classloader used to assemble the model) and cached, so endpoint extensions living only in a caller-supplied closure classloader are discovered. When no distinct classloader is present, the shared default factory is reused.
- Returns:
- the factory used to resolve endpoint components.
-
transform
Transform this BDD using the given function and return the updated BddTrait.- Parameters:
transformer- Transformer used to modify the trait.- Returns:
- the updated trait.
-
createNode
Description copied from class:AbstractTraitThe result of toNode is used for hashCodes and equality. Subclasses must implement createNode to turn the trait into a Node. This is then cached for subsequent retrievals.- Specified by:
createNodein classAbstractTrait- Returns:
- Returns the trait as a node.
-
fromNode
Creates a BddTrait from a Node representation.- Parameters:
node- the node to parse- Returns:
- the BddTrait
-
fromNode
Creates a BddTrait from a Node representation, discovering endpoint functions and built-ins using the givenclassLoader.When
classLoaderisnull, discovery falls back to this class's own loader. Use this overload when the BDD may reference functions contributed by anEndpointRuleSetExtensionthat lives in a caller-supplied classloader.- Parameters:
node- the node to parse.classLoader- the classloader used to discover endpoint extensions, or null.- Returns:
- the BddTrait.
-
builder
Creates a new builder for BddTrait.- Returns:
- a new builder
-
toBuilder
Description copied from interface:ToSmithyBuilderTake this object and create a builder that contains all of the current property values of this object.- Specified by:
toBuilderin interfaceToSmithyBuilder<EndpointBddTrait>- Returns:
- a builder for type T
-