Send feedback
Class Annotation (0.40.0)
Stay organized with collections
Save and categorize content based on your preferences.
public final class Annotation extends GeneratedMessageV3 implements AnnotationOrBuilder
Output only. Annotations can be associated with the plain-text body of the
message or with chips that link to Google Workspace resources like Google
Docs or Sheets with start_index
and length
of 0. To add basic formatting
to a text message, see Format text
messages .
Example plain-text message body:
`
Hello @FooBot how are you!"
The corresponding annotations metadata:
"annotations":[{
"type":"USER_MENTION",
"startIndex":6,
"length":7,
"userMention": {
"user": {
"name":"users/{user}",
"displayName":"FooBot",
"avatarUrl":"https://goo.gl/aeDtrS ",
"type":"BOT"
},
"type":"MENTION"
}
}]
`
Protobuf type google.chat.v1.Annotation
Inherited Members
com.google.protobuf.GeneratedMessageV3.<ListT>makeMutableCopy(ListT)
com.google.protobuf.GeneratedMessageV3.<ListT>makeMutableCopy(ListT,int)
com.google.protobuf.GeneratedMessageV3.<T>emptyList(java.lang.Class<T>)
com.google.protobuf.GeneratedMessageV3.internalGetMapFieldReflection(int)
Static Fields
public static final int CUSTOM_EMOJI_METADATA_FIELD_NUMBER
Field Value
Type
Description
int
LENGTH_FIELD_NUMBER
public static final int LENGTH_FIELD_NUMBER
Field Value
Type
Description
int
public static final int RICH_LINK_METADATA_FIELD_NUMBER
Field Value
Type
Description
int
SLASH_COMMAND_FIELD_NUMBER
public static final int SLASH_COMMAND_FIELD_NUMBER
Field Value
Type
Description
int
START_INDEX_FIELD_NUMBER
public static final int START_INDEX_FIELD_NUMBER
Field Value
Type
Description
int
TYPE_FIELD_NUMBER
public static final int TYPE_FIELD_NUMBER
Field Value
Type
Description
int
USER_MENTION_FIELD_NUMBER
public static final int USER_MENTION_FIELD_NUMBER
Field Value
Type
Description
int
Static Methods
getDefaultInstance()
public static Annotation getDefaultInstance ()
getDescriptor()
public static final Descriptors . Descriptor getDescriptor ()
newBuilder()
public static Annotation . Builder newBuilder ()
newBuilder(Annotation prototype)
public static Annotation . Builder newBuilder ( Annotation prototype )
public static Annotation parseDelimitedFrom ( InputStream input )
public static Annotation parseDelimitedFrom ( InputStream input , ExtensionRegistryLite extensionRegistry )
parseFrom(byte[] data)
public static Annotation parseFrom ( byte [] data )
Parameter
Name
Description
data
byte []
parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
public static Annotation parseFrom ( byte [] data , ExtensionRegistryLite extensionRegistry )
parseFrom(ByteString data)
public static Annotation parseFrom ( ByteString data )
parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
public static Annotation parseFrom ( ByteString data , ExtensionRegistryLite extensionRegistry )
public static Annotation parseFrom ( CodedInputStream input )
public static Annotation parseFrom ( CodedInputStream input , ExtensionRegistryLite extensionRegistry )
public static Annotation parseFrom ( InputStream input )
public static Annotation parseFrom ( InputStream input , ExtensionRegistryLite extensionRegistry )
parseFrom(ByteBuffer data)
public static Annotation parseFrom ( ByteBuffer data )
parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
public static Annotation parseFrom ( ByteBuffer data , ExtensionRegistryLite extensionRegistry )
parser()
public static Parser<Annotation> parser ()
Methods
equals(Object obj)
public boolean equals ( Object obj )
Parameter
Name
Description
obj
Object
Overrides
public CustomEmojiMetadata getCustomEmojiMetadata ()
The metadata for a custom emoji.
.google.chat.v1.CustomEmojiMetadata custom_emoji_metadata = 7;
public CustomEmojiMetadataOrBuilder getCustomEmojiMetadataOrBuilder ()
The metadata for a custom emoji.
.google.chat.v1.CustomEmojiMetadata custom_emoji_metadata = 7;
getDefaultInstanceForType()
public Annotation getDefaultInstanceForType ()
getLength()
Length of the substring in the plain-text message body this annotation
corresponds to. If not present, indicates a length of 0.
int32 length = 3;
Returns
Type
Description
int
The length.
public Annotation . MetadataCase getMetadataCase ()
getParserForType()
public Parser<Annotation> getParserForType ()
Overrides
public RichLinkMetadata getRichLinkMetadata ()
The metadata for a rich link.
.google.chat.v1.RichLinkMetadata rich_link_metadata = 6;
public RichLinkMetadataOrBuilder getRichLinkMetadataOrBuilder ()
The metadata for a rich link.
.google.chat.v1.RichLinkMetadata rich_link_metadata = 6;
getSerializedSize()
public int getSerializedSize ()
Returns
Type
Description
int
Overrides
getSlashCommand()
public SlashCommandMetadata getSlashCommand ()
The metadata for a slash command.
.google.chat.v1.SlashCommandMetadata slash_command = 5;
getSlashCommandOrBuilder()
public SlashCommandMetadataOrBuilder getSlashCommandOrBuilder ()
The metadata for a slash command.
.google.chat.v1.SlashCommandMetadata slash_command = 5;
getStartIndex()
public int getStartIndex ()
Start index (0-based, inclusive) in the plain-text message body this
annotation corresponds to.
optional int32 start_index = 2;
Returns
Type
Description
int
The startIndex.
getType()
public AnnotationType getType ()
The type of this annotation.
.google.chat.v1.AnnotationType type = 1;
getTypeValue()
public int getTypeValue ()
The type of this annotation.
.google.chat.v1.AnnotationType type = 1;
Returns
Type
Description
int
The enum numeric value on the wire for type.
getUserMention()
public UserMentionMetadata getUserMention ()
The metadata of user mention.
.google.chat.v1.UserMentionMetadata user_mention = 4;
getUserMentionOrBuilder()
public UserMentionMetadataOrBuilder getUserMentionOrBuilder ()
The metadata of user mention.
.google.chat.v1.UserMentionMetadata user_mention = 4;
public boolean hasCustomEmojiMetadata ()
The metadata for a custom emoji.
.google.chat.v1.CustomEmojiMetadata custom_emoji_metadata = 7;
Returns
Type
Description
boolean
Whether the customEmojiMetadata field is set.
public boolean hasRichLinkMetadata ()
The metadata for a rich link.
.google.chat.v1.RichLinkMetadata rich_link_metadata = 6;
Returns
Type
Description
boolean
Whether the richLinkMetadata field is set.
hasSlashCommand()
public boolean hasSlashCommand ()
The metadata for a slash command.
.google.chat.v1.SlashCommandMetadata slash_command = 5;
Returns
Type
Description
boolean
Whether the slashCommand field is set.
hasStartIndex()
public boolean hasStartIndex ()
Start index (0-based, inclusive) in the plain-text message body this
annotation corresponds to.
optional int32 start_index = 2;
Returns
Type
Description
boolean
Whether the startIndex field is set.
hasUserMention()
public boolean hasUserMention ()
The metadata of user mention.
.google.chat.v1.UserMentionMetadata user_mention = 4;
Returns
Type
Description
boolean
Whether the userMention field is set.
hashCode()
Returns
Type
Description
int
Overrides
internalGetFieldAccessorTable()
protected GeneratedMessageV3 . FieldAccessorTable internalGetFieldAccessorTable ()
Overrides
isInitialized()
public final boolean isInitialized ()
Overrides
newBuilderForType()
public Annotation . Builder newBuilderForType ()
newBuilderForType(GeneratedMessageV3.BuilderParent parent)
protected Annotation . Builder newBuilderForType ( GeneratedMessageV3 . BuilderParent parent )
Overrides
newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
protected Object newInstance ( GeneratedMessageV3 . UnusedPrivateParameter unused )
Returns
Type
Description
Object
Overrides
toBuilder()
public Annotation . Builder toBuilder ()
writeTo(CodedOutputStream output)
public void writeTo ( CodedOutputStream output )
Overrides
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-10-11 UTC.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-10-11 UTC."],[],[]]