Action.Builder

public static class Action.Builder extends Object

The builder for Action.

Nested Class Summary

@interface Action.Builder.StatusType Values that represent the state of the Action. 

Constant Summary

String ACTIVATE_ACTION The act of starting or activating something.
String ADD_ACTION The act of editing by adding something to a collection (e.g. an item to a shopping cart or movie to a queue).
String BOOKMARK_ACTION The act of bookmarking something (e.g. an article or song).
String COMMENT_ACTION The act of commenting on something (e.g. an article or social media post).
String LIKE_ACTION The act of liking something (e.g. a book, song or article).
String LISTEN_ACTION The act of listening to something (e.g. music or a podcast).
String SEND_ACTION The act of sending a message.
String SHARE_ACTION The act of sharing something (e.g. a document or social media post)
String STATUS_TYPE_ACTIVE The status of an active action (i.e. an action that has started but not yet completed).
String STATUS_TYPE_COMPLETED The status of a completed action.
String STATUS_TYPE_FAILED The status of a failed action.
String VIEW_ACTION The act of viewing something (e.g. an article or profile).
String WATCH_ACTION The act of watching something (e.g. a video, movie or TV show).

Public Constructor Summary

Action.Builder(String type)
The constructor.

Public Method Summary

Action
build()
Builds the action.
Action.Builder
setActionStatus(String actionStatus)
Sets the status of the action.
Action.Builder
setMetadata(Action.Metadata.Builder metadataBuilder)
Sets the metadata for this action.
Action.Builder
setObject(String name, String url)
Sets the object that the action is taken on (e.g. the article being viewed, or the song being listened to).
Action.Builder
setObject(String name, String url, String webUrl)
Sets the object that the action is taken on (e.g. the article being viewed, or the song being listened to).

Inherited Method Summary

Constants

public static final String ACTIVATE_ACTION

The act of starting or activating something.

Constant Value: "ActivateAction"

public static final String ADD_ACTION

The act of editing by adding something to a collection (e.g. an item to a shopping cart or movie to a queue).

Constant Value: "AddAction"

public static final String BOOKMARK_ACTION

The act of bookmarking something (e.g. an article or song).

Constant Value: "BookmarkAction"

public static final String COMMENT_ACTION

The act of commenting on something (e.g. an article or social media post).

Constant Value: "CommentAction"

public static final String LIKE_ACTION

The act of liking something (e.g. a book, song or article).

Constant Value: "LikeAction"

public static final String LISTEN_ACTION

The act of listening to something (e.g. music or a podcast).

Constant Value: "ListenAction"

public static final String SEND_ACTION

The act of sending a message.

Constant Value: "SendAction"

public static final String SHARE_ACTION

The act of sharing something (e.g. a document or social media post)

Constant Value: "ShareAction"

public static final String STATUS_TYPE_ACTIVE

The status of an active action (i.e. an action that has started but not yet completed).

Constant Value: "//schema.org/ActiveActionStatus"

public static final String STATUS_TYPE_COMPLETED

The status of a completed action.

Constant Value: "//schema.org/CompletedActionStatus"

public static final String STATUS_TYPE_FAILED

The status of a failed action.

Constant Value: "//schema.org/FailedActionStatus"

public static final String VIEW_ACTION

The act of viewing something (e.g. an article or profile).

Constant Value: "ViewAction"

public static final String WATCH_ACTION

The act of watching something (e.g. a video, movie or TV show).

Constant Value: "WatchAction"

Public Constructors

public Action.Builder (String type)

The constructor.

Parameters
type The Schema.org type best describing this action (use one of the constants on this class, or refer to //schema.org/Action for a list of standard action types).

Public Methods

public Action build ()

Builds the action.

public Action.Builder setActionStatus (String actionStatus)

Sets the status of the action. Optional.

public Action.Builder setMetadata (Action.Metadata.Builder metadataBuilder)

Sets the metadata for this action. Optional.

public Action.Builder setObject (String name, String url)

Sets the object that the action is taken on (e.g. the article being viewed, or the song being listened to).

Parameters
name The name of the object (e.g. the title of an article, or name of a song). Must not be null.
url The URL of the object (this URL needs to be handled by the app to take the user to the right place). Must be a valid URL.

public Action.Builder setObject (String name, String url, String webUrl)

Sets the object that the action is taken on (e.g. the article being viewed, or the song being listened to).

Parameters
name The name of the object (e.g. the title of an article, or name of a song). Must not be null.
url The URL of the object (this URL needs to be handled by the app to take the user to the right place). Must be a valid URL.
webUrl The web URL of the object, if different from url. Must be a valid URL.

Send feedback about...

Need help? Visit our support page.