This commit is contained in:
247
packages/java/dev/kreuzberg/HtmlMetadata.java
generated
Normal file
247
packages/java/dev/kreuzberg/HtmlMetadata.java
generated
Normal file
@@ -0,0 +1,247 @@
|
||||
// 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 java.util.Map;
|
||||
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;
|
||||
|
||||
/**
|
||||
* HTML metadata extracted from HTML documents.
|
||||
*
|
||||
* Includes document-level metadata, Open Graph data, Twitter Card metadata,
|
||||
* and extracted structural elements (headers, links, images, structured data).
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_ABSENT)
|
||||
@JsonDeserialize(builder = HtmlMetadata.Builder.class)
|
||||
public record HtmlMetadata(
|
||||
/**
|
||||
* Document title from {@code <title>} tag
|
||||
*/
|
||||
@Nullable @JsonProperty("title") String title,
|
||||
/**
|
||||
* Document description from {@code <meta name="description">} tag
|
||||
*/
|
||||
@Nullable @JsonProperty("description") String description,
|
||||
/**
|
||||
* Document keywords from {@code <meta name="keywords">} tag, split on commas
|
||||
*/
|
||||
@Nullable @JsonProperty("keywords") List<String> keywords,
|
||||
/**
|
||||
* Document author from {@code <meta name="author">} tag
|
||||
*/
|
||||
@Nullable @JsonProperty("author") String author,
|
||||
/**
|
||||
* Canonical URL from {@code <link rel="canonical">} tag
|
||||
*/
|
||||
@Nullable @JsonProperty("canonical_url") String canonicalUrl,
|
||||
/**
|
||||
* Base URL from {@code <base href="">} tag for resolving relative URLs
|
||||
*/
|
||||
@Nullable @JsonProperty("base_href") String baseHref,
|
||||
/**
|
||||
* Document language from {@code lang} attribute
|
||||
*/
|
||||
@Nullable @JsonProperty("language") String language,
|
||||
/**
|
||||
* Document text direction from {@code dir} attribute
|
||||
*/
|
||||
@Nullable @JsonProperty("text_direction") TextDirection textDirection,
|
||||
/**
|
||||
* Open Graph metadata (og:* properties) for social media
|
||||
* Keys like "title", "description", "image", "url", etc.
|
||||
*/
|
||||
@Nullable @JsonProperty("open_graph") Map<String, String> openGraph,
|
||||
/**
|
||||
* Twitter Card metadata (twitter:* properties)
|
||||
* Keys like "card", "site", "creator", "title", "description", "image", etc.
|
||||
*/
|
||||
@Nullable @JsonProperty("twitter_card") Map<String, String> twitterCard,
|
||||
/**
|
||||
* Additional meta tags not covered by specific fields
|
||||
* Keys are meta name/property attributes, values are content
|
||||
*/
|
||||
@Nullable @JsonProperty("meta_tags") Map<String, String> metaTags,
|
||||
/**
|
||||
* Extracted header elements with hierarchy
|
||||
*/
|
||||
@Nullable @JsonProperty("headers") List<HeaderMetadata> headers,
|
||||
/**
|
||||
* Extracted hyperlinks with type classification
|
||||
*/
|
||||
@Nullable @JsonProperty("links") List<LinkMetadata> links,
|
||||
/**
|
||||
* Extracted images with source and dimensions
|
||||
*/
|
||||
@Nullable @JsonProperty("images") List<ImageMetadataType> images,
|
||||
/**
|
||||
* Extracted structured data blocks
|
||||
*/
|
||||
@Nullable @JsonProperty("structured_data") List<StructuredData> structuredData
|
||||
) {
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
// CPD-OFF
|
||||
@JsonPOJOBuilder(withPrefix = "with", buildMethodName = "build")
|
||||
public static final class Builder {
|
||||
|
||||
private String title = null;
|
||||
private String description = null;
|
||||
private List<String> keywords = null;
|
||||
private String author = null;
|
||||
@JsonProperty("canonical_url")
|
||||
private String canonicalUrl = null;
|
||||
@JsonProperty("base_href")
|
||||
private String baseHref = null;
|
||||
private String language = null;
|
||||
@JsonProperty("text_direction")
|
||||
private TextDirection textDirection = null;
|
||||
@JsonProperty("open_graph")
|
||||
private Map<String, String> openGraph = null;
|
||||
@JsonProperty("twitter_card")
|
||||
private Map<String, String> twitterCard = null;
|
||||
@JsonProperty("meta_tags")
|
||||
private Map<String, String> metaTags = null;
|
||||
private List<HeaderMetadata> headers = null;
|
||||
private List<LinkMetadata> links = null;
|
||||
private List<ImageMetadataType> images = null;
|
||||
@JsonProperty("structured_data")
|
||||
private List<StructuredData> structuredData = null;
|
||||
|
||||
/** Sets the title field. */
|
||||
@JsonProperty("title")
|
||||
public Builder withTitle(final @Nullable String value) {
|
||||
this.title = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the description field. */
|
||||
@JsonProperty("description")
|
||||
public Builder withDescription(final @Nullable String value) {
|
||||
this.description = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the keywords field. */
|
||||
@JsonProperty("keywords")
|
||||
public Builder withKeywords(final @Nullable List<String> value) {
|
||||
this.keywords = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the author field. */
|
||||
@JsonProperty("author")
|
||||
public Builder withAuthor(final @Nullable String value) {
|
||||
this.author = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the canonicalUrl field. */
|
||||
@JsonProperty("canonical_url")
|
||||
public Builder withCanonicalUrl(final @Nullable String value) {
|
||||
this.canonicalUrl = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the baseHref field. */
|
||||
@JsonProperty("base_href")
|
||||
public Builder withBaseHref(final @Nullable String value) {
|
||||
this.baseHref = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the language field. */
|
||||
@JsonProperty("language")
|
||||
public Builder withLanguage(final @Nullable String value) {
|
||||
this.language = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the textDirection field. */
|
||||
@JsonProperty("text_direction")
|
||||
public Builder withTextDirection(final @Nullable TextDirection value) {
|
||||
this.textDirection = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the openGraph field. */
|
||||
@JsonProperty("open_graph")
|
||||
public Builder withOpenGraph(final @Nullable Map<String, String> value) {
|
||||
this.openGraph = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the twitterCard field. */
|
||||
@JsonProperty("twitter_card")
|
||||
public Builder withTwitterCard(final @Nullable Map<String, String> value) {
|
||||
this.twitterCard = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the metaTags field. */
|
||||
@JsonProperty("meta_tags")
|
||||
public Builder withMetaTags(final @Nullable Map<String, String> value) {
|
||||
this.metaTags = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the headers field. */
|
||||
@JsonProperty("headers")
|
||||
public Builder withHeaders(final @Nullable List<HeaderMetadata> value) {
|
||||
this.headers = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the links field. */
|
||||
@JsonProperty("links")
|
||||
public Builder withLinks(final @Nullable List<LinkMetadata> value) {
|
||||
this.links = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the images field. */
|
||||
@JsonProperty("images")
|
||||
public Builder withImages(final @Nullable List<ImageMetadataType> value) {
|
||||
this.images = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the structuredData field. */
|
||||
@JsonProperty("structured_data")
|
||||
public Builder withStructuredData(final @Nullable List<StructuredData> value) {
|
||||
this.structuredData = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Builds the HtmlMetadata instance. */
|
||||
public HtmlMetadata build() {
|
||||
return new HtmlMetadata(
|
||||
title,
|
||||
description,
|
||||
keywords,
|
||||
author,
|
||||
canonicalUrl,
|
||||
baseHref,
|
||||
language,
|
||||
textDirection,
|
||||
openGraph,
|
||||
twitterCard,
|
||||
metaTags,
|
||||
headers,
|
||||
links,
|
||||
images,
|
||||
structuredData
|
||||
);
|
||||
}
|
||||
}
|
||||
// CPD-ON
|
||||
}
|
||||
Reference in New Issue
Block a user