public abstract class DataTransferObjectDescriptor<T extends DataTransferObject> extends Object
Modifier and Type | Class and Description |
---|---|
static class |
DataTransferObjectDescriptor.BuilderBuildFailedException
Checked exception thrown by
DataTransferObjectDescriptor.BuilderBuildFunction when a user error (not internal error)
occurs. |
static interface |
DataTransferObjectDescriptor.BuilderBuildFunction<T>
A function to build a builder returned by
getBuilderFactory() |
Constructor and Description |
---|
DataTransferObjectDescriptor() |
Modifier and Type | Method and Description |
---|---|
T |
build(Object builder,
Object context)
Builds the partially constructed object returned by
getBuilderFactory() |
abstract java.util.function.Supplier<Object> |
getBuilderFactory()
Get the builder for a constructor arg.
|
protected abstract DataTransferObjectDescriptor.BuilderBuildFunction<T> |
getBuildFunction()
A function that takes the result of
getBuilderFactory() }, and calls its 'build'
function to return description args of type T |
abstract com.google.common.collect.ImmutableMap<String,ParamInfo<?>> |
getParamInfos()
The param infos needed to populate this object
|
abstract Class<T> |
objectClass()
Reified
<T> |
static <T extends DataTransferObject> |
of(Class<T> objectClass,
java.util.function.Supplier<Object> builderFactory,
Map<String,? extends ParamInfo<?>> paramInfos,
DataTransferObjectDescriptor.BuilderBuildFunction<T> buildFunction) |
public abstract java.util.function.Supplier<Object> getBuilderFactory()
This is either the ImmutableValue.Builder class for T
, or SkylarkDescriptionArg
public abstract com.google.common.collect.ImmutableMap<String,ParamInfo<?>> getParamInfos()
protected abstract DataTransferObjectDescriptor.BuilderBuildFunction<T> getBuildFunction()
getBuilderFactory()
}, and calls its 'build'
function to return description args of type T
public T build(Object builder, Object context)
getBuilderFactory()
T
obtained by applying getBuildFunction()
to getBuilderFactory()
public static <T extends DataTransferObject> DataTransferObjectDescriptor<T> of(Class<T> objectClass, java.util.function.Supplier<Object> builderFactory, Map<String,? extends ParamInfo<?>> paramInfos, DataTransferObjectDescriptor.BuilderBuildFunction<T> buildFunction)