Package jsonvalues.spec
Class JsFixedBuilder
java.lang.Object
jsonvalues.spec.JsFixedBuilder
Builder class for creating instances of
JsFixedBinary, which represents a fixed-size binary type. Fixed
binary types have a fixed size specified at the time of creation and are used in Avro schemas to represent fixed-size
binary data.
Note: This builder is specifically designed for creating Avro schemas. If you are not working with Avro schemas and
just need a fixed-size binary specification, consider using JsSpecs.fixedBinary(int).
-
Method Summary
Modifier and TypeMethodDescriptionbuild(int size) Builds and returns aJsFixedBinaryspecification with the specified size.withAliases(List<String> aliases) Sets aliases for the fixed binary.Sets the documentation for the fixed binary.static JsFixedBuilderSets the name of the fixed binary specification.withNamespace(String nameSpace) Sets the namespace of the fixed binary specification.
-
Method Details
-
withName
Sets the name of the fixed binary specification. The name must follow the Avro naming conventions, adhering to the regex pattern:[A-Za-z_][A-Za-z0-9_]*.- Parameters:
name- The name of the enum.- Returns:
- A new
JsFixedBuilderinstance. - Throws:
IllegalArgumentException- If the provided name does not follow the specified pattern.
-
withNamespace
Sets the namespace of the fixed binary specification. The namespace must follow the Avro naming conventions, adhering to the regex pattern:[A-Za-z_][A-Za-z0-9_.]+. It should start with a letter or an underscore, followed by letters, numbers, underscores, or dots.- Parameters:
nameSpace- The namespace of the enum specification.- Returns:
- A reference to this
JsFixedBuilderinstance for method chaining. - Throws:
IllegalArgumentException- If the provided namespace does not follow the Avro naming conventions.
-
withDoc
Sets the documentation for the fixed binary.- Parameters:
doc- The documentation fixed binary.- Returns:
- This JsFixedBuilder for method chaining.
-
withAliases
Sets aliases for the fixed binary. Must follow the avro naming conventions and, adhering to the regex pattern:[A-Za-z_][A-Za-z0-9_.]+Aliases provide alternative names for the fixed binary, and they can be used interchangeably when referring to the same specification.
- Parameters:
aliases- A list of alternative names (aliases) for the fixed binary.- Returns:
- This JsFixedBuilder for method chaining.
- Throws:
IllegalArgumentException- If any of the provided aliases does not follow the naming pattern.
-
build
Builds and returns aJsFixedBinaryspecification with the specified size.- Parameters:
size- The size of the fixed binary.- Returns:
- The constructed
JsFixedBinaryspecification. - Throws:
IllegalArgumentException- If the size is less than or equal to 0.
-