Package software.amazon.smithy.utils
Class DefaultBuilderRef<T>
java.lang.Object
software.amazon.smithy.utils.DefaultBuilderRef<T>
- Type Parameters:
T- The type of value being built, borrowed, and copied.
- All Implemented Interfaces:
BuilderRef<T>
Default implementation of
BuilderRef.
This class is not threadsafe; it should only be used to build up
other objects using copy().
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
DefaultBuilderRef
-
-
Method Details
-
get
-
peek
-
copy
Description copied from interface:BuilderRefCreates an immutable copy ofT.Subsequent calls to
BuilderRef.hasValue()may or may not return true after this method is called.- Specified by:
copyin interfaceBuilderRef<T>- Returns:
- Returns the copied immutable value.
-
hasValue
public boolean hasValue()Description copied from interface:BuilderRefChecks if the reference currently has a borrowed or owned value.This method does not check if the contained value is considered empty. This method only returns true if the reference contains any kind of previously built value. This might be useful for builder methods that attempt to remove values from the contained object. If there is no contained object, then there's no need to create one just to remove a value from an empty container.
- Specified by:
hasValuein interfaceBuilderRef<T>- Returns:
- Returns true if the reference contains a value of any kind.
-
clear
public void clear()Description copied from interface:BuilderRefRemoves any borrowed or owned values from the reference.Subsequent calls to
BuilderRef.hasValue()will return false after this method is called.- Specified by:
clearin interfaceBuilderRef<T>
-