Class RulesComponentBuilder<B extends RulesComponentBuilder<?,?>,T>
- java.lang.Object
-
- software.amazon.smithy.rulesengine.language.RulesComponentBuilder<B,T>
-
- Type Parameters:
B
- Type of the builderT
- Type of the type that is built
- All Implemented Interfaces:
FromSourceLocation
,SmithyBuilder<T>
- Direct Known Subclasses:
Endpoint.Builder
,EndpointRuleSet.Builder
,EndpointValue.Builder
,FunctionNode.Builder
,Parameter.Builder
,Parameters.Builder
,Partition.Builder
,PartitionOutputs.Builder
,Partitions.Builder
,RegionOverride.Builder
public abstract class RulesComponentBuilder<B extends RulesComponentBuilder<?,?>,T> extends java.lang.Object implements SmithyBuilder<T>, FromSourceLocation
Builder which also tracks sourceLocation of inputs. If no source location is provided, the source location defaults to the Java file/line number of the caller.
-
-
Constructor Summary
Constructors Constructor Description RulesComponentBuilder(FromSourceLocation fromSourceLocation)
Creates a builder with the given source location.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SourceLocation
getSourceLocation()
Gets the source location of a value.static SourceLocation
javaLocation()
Returns the source code location of the caller.B
sourceLocation(FromSourceLocation fromSourceLocation)
Sets the source location for the builder.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface software.amazon.smithy.utils.SmithyBuilder
build
-
-
-
-
Constructor Detail
-
RulesComponentBuilder
public RulesComponentBuilder(FromSourceLocation fromSourceLocation)
Creates a builder with the given source location.- Parameters:
fromSourceLocation
- the source location for the builder.
-
-
Method Detail
-
getSourceLocation
public SourceLocation getSourceLocation()
Description copied from interface:FromSourceLocation
Gets the source location of a value.- Specified by:
getSourceLocation
in interfaceFromSourceLocation
- Returns:
- Returns the source location of the value.
-
sourceLocation
public B sourceLocation(FromSourceLocation fromSourceLocation)
Sets the source location for the builder.- Parameters:
fromSourceLocation
- the source location to set.- Returns:
- the updated builder.
-
javaLocation
public static SourceLocation javaLocation()
Returns the source code location of the caller. This is very helpful when determining where rules generated from Java-based builders originated.Library-local and JDK stack frames are discarded. If no relevant location can be found, `SourceLocation.none()` is returned.
- Returns:
- The SourceLocation.
-
-