124 lines
3.7 KiB
Java
Generated
124 lines
3.7 KiB
Java
Generated
// This file is auto-generated by alef — DO NOT EDIT.
|
|
// alef:hash:4e15143f4af1ae8bafbdb1506ef057da924484c66a19483966333558ad437e75
|
|
// To regenerate: alef generate
|
|
// To verify freshness: alef verify --exit-code
|
|
// Issues & docs: https://github.com/kreuzberg-dev/alef
|
|
package dev.kreuzberg;
|
|
|
|
import java.util.List;
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
|
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
|
|
import org.jspecify.annotations.Nullable;
|
|
|
|
/**
|
|
* Text/Markdown metadata.
|
|
*
|
|
* Extracted from plain text and Markdown files. Includes word counts and,
|
|
* for Markdown, structural elements like headers and links.
|
|
*/
|
|
@JsonInclude(JsonInclude.Include.NON_ABSENT)
|
|
@JsonDeserialize(builder = TextMetadata.Builder.class)
|
|
public record TextMetadata(
|
|
/**
|
|
* Number of lines in the document
|
|
*/
|
|
@JsonProperty("line_count") int lineCount,
|
|
/**
|
|
* Number of words
|
|
*/
|
|
@JsonProperty("word_count") int wordCount,
|
|
/**
|
|
* Number of characters
|
|
*/
|
|
@JsonProperty("character_count") int characterCount,
|
|
/**
|
|
* Markdown headers (headings text only, for Markdown files)
|
|
*/
|
|
@Nullable @JsonProperty("headers") List<String> headers,
|
|
/**
|
|
* Markdown links as (text, url) tuples (for Markdown files)
|
|
*/
|
|
@Nullable @JsonProperty("links") List<List<String>> links,
|
|
/**
|
|
* Code blocks as (language, code) tuples (for Markdown files)
|
|
*/
|
|
@Nullable @JsonProperty("code_blocks") List<List<String>> codeBlocks
|
|
) {
|
|
public static Builder builder() {
|
|
return new Builder();
|
|
}
|
|
|
|
// CPD-OFF
|
|
@JsonPOJOBuilder(withPrefix = "with", buildMethodName = "build")
|
|
public static final class Builder {
|
|
|
|
@JsonProperty("line_count")
|
|
private int lineCount = 0;
|
|
@JsonProperty("word_count")
|
|
private int wordCount = 0;
|
|
@JsonProperty("character_count")
|
|
private int characterCount = 0;
|
|
private List<String> headers = null;
|
|
private List<List<String>> links = null;
|
|
@JsonProperty("code_blocks")
|
|
private List<List<String>> codeBlocks = null;
|
|
|
|
/** Sets the lineCount field. */
|
|
@JsonProperty("line_count")
|
|
public Builder withLineCount(final int value) {
|
|
this.lineCount = value;
|
|
return this;
|
|
}
|
|
|
|
/** Sets the wordCount field. */
|
|
@JsonProperty("word_count")
|
|
public Builder withWordCount(final int value) {
|
|
this.wordCount = value;
|
|
return this;
|
|
}
|
|
|
|
/** Sets the characterCount field. */
|
|
@JsonProperty("character_count")
|
|
public Builder withCharacterCount(final int value) {
|
|
this.characterCount = value;
|
|
return this;
|
|
}
|
|
|
|
/** Sets the headers field. */
|
|
@JsonProperty("headers")
|
|
public Builder withHeaders(final @Nullable List<String> value) {
|
|
this.headers = value;
|
|
return this;
|
|
}
|
|
|
|
/** Sets the links field. */
|
|
@JsonProperty("links")
|
|
public Builder withLinks(final @Nullable List<List<String>> value) {
|
|
this.links = value;
|
|
return this;
|
|
}
|
|
|
|
/** Sets the codeBlocks field. */
|
|
@JsonProperty("code_blocks")
|
|
public Builder withCodeBlocks(final @Nullable List<List<String>> value) {
|
|
this.codeBlocks = value;
|
|
return this;
|
|
}
|
|
|
|
/** Builds the TextMetadata instance. */
|
|
public TextMetadata build() {
|
|
return new TextMetadata(
|
|
lineCount,
|
|
wordCount,
|
|
characterCount,
|
|
headers,
|
|
links,
|
|
codeBlocks
|
|
);
|
|
}
|
|
}
|
|
// CPD-ON
|
|
}
|