Class Block.Builder
- java.lang.Object
-
- ai.extend.types.Block.Builder
-
- All Implemented Interfaces:
Block._FinalStage,Block.BoundingBoxStage,Block.ContentStage,Block.DetailsStage,Block.IdStage,Block.MetadataStage,Block.TypeStage
- Enclosing class:
- Block
public static final class Block.Builder extends java.lang.Object implements Block.IdStage, Block.TypeStage, Block.ContentStage, Block.DetailsStage, Block.MetadataStage, Block.BoundingBoxStage, Block._FinalStage
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Block._FinalStageaddAllPolygon(java.util.List<BlockPolygonItem> polygon)An array of points defining the polygon that bounds the block.Block._FinalStageaddPolygon(BlockPolygonItem polygon)An array of points defining the polygon that bounds the block.Block._FinalStageboundingBox(BoundingBox boundingBox)A simplified bounding box for the block.Blockbuild()Block._FinalStagechildren(java.util.List<Block> children)An array of child blocks.Block._FinalStagechildren(java.util.Optional<java.util.List<Block>> children)An array of child blocks.Block.DetailsStagecontent(java.lang.String content)The textual content of the block formatted based on the target format.Block.MetadataStagedetails(BlockDetails details)Additional details specific to the block type.Block.Builderfrom(Block other)Block.TypeStageid(java.lang.String id)A unique identifier for the block, deterministically generated as a hash of the block content.Block.BoundingBoxStagemetadata(BlockMetadata metadata)Metadata about the block.Block._FinalStageparentBlockId(java.lang.String parentBlockId)The ID of the parent block.Block._FinalStageparentBlockId(java.util.Optional<java.lang.String> parentBlockId)The ID of the parent block.Block._FinalStagepolygon(java.util.List<BlockPolygonItem> polygon)An array of points defining the polygon that bounds the block.Block.ContentStagetype(BlockType type)The type of block:
-
-
-
Method Detail
-
from
public Block.Builder from(Block other)
- Specified by:
fromin interfaceBlock.IdStage
-
id
public Block.TypeStage id(@NotNull java.lang.String id)
A unique identifier for the block, deterministically generated as a hash of the block content.
A unique identifier for the block, deterministically generated as a hash of the block content.
- Specified by:
idin interfaceBlock.IdStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
type
public Block.ContentStage type(@NotNull BlockType type)
The type of block:
"text"- Regular text content"heading"- Section or document headings"section_heading"- Subsection headings"table"- Tabular data with rows and columns"figure"- Images, charts, diagrams, or logos"table_head"- Table header cells"table_cell"- Table body cells"key_value"- Key-value pairs (e.g., form regions, key-val groups, etc)"page_number"- Page number indicators"barcode"- Barcodes and QR codes"formula"- Mathematical formulas and equations"header"- Page headers"footer"- Page footers
The type of block:
"text"- Regular text content"heading"- Section or document headings"section_heading"- Subsection headings"table"- Tabular data with rows and columns"figure"- Images, charts, diagrams, or logos"table_head"- Table header cells"table_cell"- Table body cells"key_value"- Key-value pairs (e.g., form regions, key-val groups, etc)"page_number"- Page number indicators"barcode"- Barcodes and QR codes"formula"- Mathematical formulas and equations"header"- Page headers"footer"- Page footers
- Specified by:
typein interfaceBlock.TypeStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
content
public Block.DetailsStage content(@NotNull java.lang.String content)
The textual content of the block formatted based on the target format.
The textual content of the block formatted based on the target format.
- Specified by:
contentin interfaceBlock.ContentStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
details
public Block.MetadataStage details(@NotNull BlockDetails details)
Additional details specific to the block type. The schema depends on the block type.
Additional details specific to the block type. The schema depends on the block type.
- Specified by:
detailsin interfaceBlock.DetailsStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
metadata
public Block.BoundingBoxStage metadata(@NotNull BlockMetadata metadata)
Metadata about the block.
Metadata about the block.
- Specified by:
metadatain interfaceBlock.MetadataStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
boundingBox
public Block._FinalStage boundingBox(@NotNull BoundingBox boundingBox)
A simplified bounding box for the block.
A simplified bounding box for the block.
- Specified by:
boundingBoxin interfaceBlock.BoundingBoxStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
children
public Block._FinalStage children(java.util.List<Block> children)
An array of child blocks. For example, a table block may contain table cell blocks as children when
cellBlocksEnabledis set to true.- Specified by:
childrenin interfaceBlock._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
children
public Block._FinalStage children(java.util.Optional<java.util.List<Block>> children)
An array of child blocks. For example, a table block may contain table cell blocks as children when
cellBlocksEnabledis set to true.- Specified by:
childrenin interfaceBlock._FinalStage
-
addAllPolygon
public Block._FinalStage addAllPolygon(java.util.List<BlockPolygonItem> polygon)
An array of points defining the polygon that bounds the block.
- Specified by:
addAllPolygonin interfaceBlock._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
addPolygon
public Block._FinalStage addPolygon(BlockPolygonItem polygon)
An array of points defining the polygon that bounds the block.
- Specified by:
addPolygonin interfaceBlock._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
polygon
public Block._FinalStage polygon(java.util.List<BlockPolygonItem> polygon)
An array of points defining the polygon that bounds the block.
- Specified by:
polygonin interfaceBlock._FinalStage
-
parentBlockId
public Block._FinalStage parentBlockId(java.lang.String parentBlockId)
The ID of the parent block. For example, for a table cell block, this would be the ID of the parent table block. Only set if this is a child block.
- Specified by:
parentBlockIdin interfaceBlock._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
parentBlockId
public Block._FinalStage parentBlockId(java.util.Optional<java.lang.String> parentBlockId)
The ID of the parent block. For example, for a table cell block, this would be the ID of the parent table block. Only set if this is a child block.
- Specified by:
parentBlockIdin interfaceBlock._FinalStage
-
build
public Block build()
- Specified by:
buildin interfaceBlock._FinalStage
-
-