Package com.attribyte.parser.model
Class Image
java.lang.Object
com.attribyte.parser.model.Image
An immutable image.
- Author:
- Matt Hamer
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal StringText that describes the image, or an empty string if none.final StringAn image credit.final Optional<com.google.protobuf.ByteString> The image data (bytes), if available.final intThe image height or0if unknown.final StringA unique id, or an empty string if none.final StringA link to the image.final StringThe media type (for example,image/png), or an empty string if unknown.final StringA title for the image, or an empty string if none.final intThe image width or0if unknown. -
Method Summary
Modifier and TypeMethodDescriptionstatic Image.Builderbuilder(byte[] data) Creates a builder for images with data.static Image.BuilderCreates a builder from an existing image.static Image.BuilderCreates a builder for images with a link.booleaninthashCode()toString()withNewLink(String link) Creates a copy of this image with a new link.
-
Field Details
-
id
A unique id, or an empty string if none. -
link
A link to the image. Nevernullor empty. -
altText
Text that describes the image, or an empty string if none. -
title
A title for the image, or an empty string if none. -
credit
An image credit. -
width
public final int widthThe image width or0if unknown. -
height
public final int heightThe image height or0if unknown. -
mediaType
The media type (for example,image/png), or an empty string if unknown. -
data
The image data (bytes), if available.
-
-
Method Details
-
builder
Creates a builder for images with a link.- Parameters:
link- The link.- Returns:
- The builder.
- Throws:
UnsupportedOperationException- If the specified link isnullor empty.
-
builder
Creates a builder for images with data.- Parameters:
data- The data.- Returns:
- The builder.
- Throws:
UnsupportedOperationException- If the specified data isnullor empty.
-
builder
Creates a builder from an existing image.- Parameters:
image- The image.- Returns:
- The builder initialized from the existing image.
-
withNewLink
Creates a copy of this image with a new link.- Parameters:
link- The new link.- Returns:
- The new image.
- Throws:
UnsupportedOperationException- If the specified link isnullor empty.
-
toString
-
hashCode
public int hashCode() -
equals
-