Class ModelMetadata.Builder
- java.lang.Object
-
- com.codedstream.otterstream.inference.model.ModelMetadata.Builder
-
- Enclosing class:
- ModelMetadata
public static class ModelMetadata.Builder extends Object
Builder for constructingModelMetadatainstances.Provides a fluent API for setting metadata attributes with sensible defaults:
- modelVersion: "unknown"
- inputSchema: empty map
- outputSchema: empty map
- modelSize: 0L
- loadTimestamp: current system time
Example:
ModelMetadata metadata = ModelMetadata.builder() .modelName("resnet50") .format(ModelFormat.ONNX) .modelSize(1024 * 1024 * 100) // 100MB .build();
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ModelMetadatabuild()Builds a new ModelMetadata instance.ModelMetadata.Builderformat(ModelFormat format)Sets the model format.ModelMetadata.BuilderinputSchema(Map<String,Object> inputSchema)Sets the input schema.ModelMetadata.BuilderloadTimestamp(long loadTimestamp)Sets the load timestamp.ModelMetadata.BuildermodelName(String modelName)Sets the model name.ModelMetadata.BuildermodelSize(long modelSize)Sets the model size in bytes.ModelMetadata.BuildermodelVersion(String modelVersion)Sets the model version.ModelMetadata.BuilderoutputSchema(Map<String,Object> outputSchema)Sets the output schema.
-
-
-
Method Detail
-
modelName
public ModelMetadata.Builder modelName(String modelName)
Sets the model name.- Parameters:
modelName- the model name- Returns:
- this builder for method chaining
-
modelVersion
public ModelMetadata.Builder modelVersion(String modelVersion)
Sets the model version.Defaults to "unknown" if not specified.
- Parameters:
modelVersion- the model version- Returns:
- this builder for method chaining
-
format
public ModelMetadata.Builder format(ModelFormat format)
Sets the model format.- Parameters:
format- the model format- Returns:
- this builder for method chaining
-
inputSchema
public ModelMetadata.Builder inputSchema(Map<String,Object> inputSchema)
Sets the input schema.Creates a defensive copy of the provided map.
- Parameters:
inputSchema- map of input names to schema definitions- Returns:
- this builder for method chaining
-
outputSchema
public ModelMetadata.Builder outputSchema(Map<String,Object> outputSchema)
Sets the output schema.Creates a defensive copy of the provided map.
- Parameters:
outputSchema- map of output names to schema definitions- Returns:
- this builder for method chaining
-
modelSize
public ModelMetadata.Builder modelSize(long modelSize)
Sets the model size in bytes.Defaults to 0L if not specified.
- Parameters:
modelSize- size in bytes- Returns:
- this builder for method chaining
-
loadTimestamp
public ModelMetadata.Builder loadTimestamp(long loadTimestamp)
Sets the load timestamp.Defaults to current system time if not specified.
- Parameters:
loadTimestamp- timestamp in epoch milliseconds- Returns:
- this builder for method chaining
-
build
public ModelMetadata build()
Builds a new ModelMetadata instance.- Returns:
- a new immutable ModelMetadata instance
- Throws:
NullPointerException- if modelName or format is null
-
-