public class

GoogleBaseAttribute

extends Object
java.lang.Object
   ↳ com.google.api.gbase.client.GoogleBaseAttribute

Class Overview

An internal representation for a tag in the g: namespace.

Summary

Fields
private Adjustments adjustments Corresponds to the XML attributes gm:adjusted_name and gm:adjusted_value, or null if none of these tags is specified.
private final GoogleBaseAttributeId attributeId Attribute name (with spaces) and type.
private boolean privateAccess Corresponds to the XML attribute access="private".
private List<GoogleBaseAttribute> subAttributes Sub-attributes if there are any.
private Multimap<String, String> subElements Tag sub-elements (element name, element value) if there are any.
private String textValue Content of the tag, as text or null for complex tags.
private List<Thumbnail> thumbnails
Public Constructors
GoogleBaseAttribute(String name)
Creates a new GoogleBaseAttribute with a name and no type.
GoogleBaseAttribute(String name, GoogleBaseAttributeType type)
Creates a new GoogleBaseAttribute with a name and type.
GoogleBaseAttribute(String name, GoogleBaseAttributeType type, String textValue)
Creates a new Extension attribute with a name, type and string content.
GoogleBaseAttribute(String name, GoogleBaseAttributeType type, boolean privateAccess)
Creates a new GoogleBaseAttribute with a name and type.
GoogleBaseAttribute(String name, GoogleBaseAttributeType type, boolean privateAccess, String textValue)
Creates a new Extension attribute with a name, type and string content.
GoogleBaseAttribute(GoogleBaseAttributeId attributeId, String textValue)
Creates a new Extension attribute with an GoogleBaseAttributeId and string content.
Public Methods
void addSubAttribute(GoogleBaseAttribute value)
Appends the value to the subAttribute list.
void appendSubElement(String name, String value)
Appends the value to a sub-tag value list.
boolean equals(Object o)
Adjustments getAdjustments()
Gets the adjustments for this attribute.
GoogleBaseAttributeId getAttributeId()
Returns the attribute identity, name and type.
String getName()
Gets the attribute name.
List<GoogleBaseAttribute> getSubAttributes()
Gets all sub-attributes.
Collection<? extends String> getSubElementNames()
Gets the name of all sub-elements in this attribute.
String getSubElementValue(String name)
Gets a value of a sub-tag.
Collection<String> getSubElementValues(String name)
Gets all values correspond to the sub-tag.
List<Thumbnail> getThumbnails()
Gets the reference to the list of thumbnails for this attribute.
GoogleBaseAttributeType getType()
Gets the type of the attribute, or null.
String getValueAsString()
Gets the attribute value, as a string (or null).
boolean hasAdjustments()
boolean hasSubAttributes()
Returns true if the attribute has sub-attributes.
boolean hasSubElement(String name)
Checks whether a specific sub-element exists.
boolean hasSubElements()
Returns true if the attribute has sub-tags.
boolean hasThumbnails()
Returns true if the attribute has thumbnails, false otherwise.
boolean hasValue()
Returns true if the attribute has some text content.
int hashCode()
boolean isPrivate()
Checks whether the attribute should only be shown to the owner of this item.
void removeSubElement(String name)
Removes a sub-element.
void setPrivate(boolean privateAccess)
Declares the attribute as being private or public (the default).
void setSubElement(String name, String value)
Sets the value of a sub-tag.
void setValue(String value)
Sets the attribute value, as a string.
String toString()
Generates a string representation of this attribute.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

private Adjustments adjustments

Corresponds to the XML attributes gm:adjusted_name and gm:adjusted_value, or null if none of these tags is specified.

private final GoogleBaseAttributeId attributeId

Attribute name (with spaces) and type.

private boolean privateAccess

Corresponds to the XML attribute access="private".

private List<GoogleBaseAttribute> subAttributes

Sub-attributes if there are any.

private Multimap<String, String> subElements

Tag sub-elements (element name, element value) if there are any.

private String textValue

Content of the tag, as text or null for complex tags.

private List<Thumbnail> thumbnails

Public Constructors

public GoogleBaseAttribute (String name)

Creates a new GoogleBaseAttribute with a name and no type.

Parameters
name

public GoogleBaseAttribute (String name, GoogleBaseAttributeType type)

Creates a new GoogleBaseAttribute with a name and type.

Parameters
name
type Attribute type, one of the TYPE_* defined in this class, or null

public GoogleBaseAttribute (String name, GoogleBaseAttributeType type, String textValue)

Creates a new Extension attribute with a name, type and string content.

Parameters
name
type Type attribute type, one of the types defined in GoogleBaseAttributeType, some new type or null
textValue Content of the attribute, as a string
Throws
NullPointerException if argument name is null

public GoogleBaseAttribute (String name, GoogleBaseAttributeType type, boolean privateAccess)

Creates a new GoogleBaseAttribute with a name and type.

Parameters
name
type Attribute type, one of the TYPE_* defined in this class, or null
privateAccess If this attributeId is private

public GoogleBaseAttribute (String name, GoogleBaseAttributeType type, boolean privateAccess, String textValue)

Creates a new Extension attribute with a name, type and string content.

Parameters
name
type Type attribute type, one of the types defined in GoogleBaseAttributeType, some new type or null
privateAccess If this attribute is private
textValue Content of the attribute, as a string
Throws
NullPointerException if argument name is null

public GoogleBaseAttribute (GoogleBaseAttributeId attributeId, String textValue)

Creates a new Extension attribute with an GoogleBaseAttributeId and string content.

Parameters
attributeId Attribute name and type
textValue Content of the attribute, as a string
Throws
NullPointerException if argument name is null

Public Methods

public void addSubAttribute (GoogleBaseAttribute value)

Appends the value to the subAttribute list.

Parameters
value

public void appendSubElement (String name, String value)

Appends the value to a sub-tag value list. If the sub-tag doesn't exist, it will be created first. If the value is null, the method will do nothing.

Parameters
name Tag name
value Tag content to be appended.

public boolean equals (Object o)

Parameters
o

public Adjustments getAdjustments ()

Gets the adjustments for this attribute. If no adjustments are present, an empty Adjustments object is created, linked to this attribute and returned.

Returns
  • the adjustments for this attribute.

public GoogleBaseAttributeId getAttributeId ()

Returns the attribute identity, name and type.

Returns
  • attribute name and type

public String getName ()

Gets the attribute name.

public List<GoogleBaseAttribute> getSubAttributes ()

Gets all sub-attributes.

Returns
  • A list of all sub-attributes (can be empty but not null).

public Collection<? extends String> getSubElementNames ()

Gets the name of all sub-elements in this attribute.

Returns
  • a collection of element names, which might be empty but not null

public String getSubElementValue (String name)

Gets a value of a sub-tag.

Parameters
name Tag name
Returns
  • sub-tag text content or null

public Collection<String> getSubElementValues (String name)

Gets all values correspond to the sub-tag.

Parameters
name Name
Returns
  • A collection of text content corresponds to the sub-tag (can be empty)

public List<Thumbnail> getThumbnails ()

Gets the reference to the list of thumbnails for this attribute. The result might be empty, but never null.

public GoogleBaseAttributeType getType ()

Gets the type of the attribute, or null.

public String getValueAsString ()

Gets the attribute value, as a string (or null).

public boolean hasAdjustments ()

public boolean hasSubAttributes ()

Returns true if the attribute has sub-attributes.

public boolean hasSubElement (String name)

Checks whether a specific sub-element exists.

Parameters
name Element name
Returns
  • true if the sub-element exists

public boolean hasSubElements ()

Returns true if the attribute has sub-tags.

public boolean hasThumbnails ()

Returns true if the attribute has thumbnails, false otherwise.

public boolean hasValue ()

Returns true if the attribute has some text content.

public int hashCode ()

public boolean isPrivate ()

Checks whether the attribute should only be shown to the owner of this item.

public void removeSubElement (String name)

Removes a sub-element.

Parameters
name Element names

public void setPrivate (boolean privateAccess)

Declares the attribute as being private or public (the default).

Parameters
privateAccess

public void setSubElement (String name, String value)

Sets the value of a sub-tag.

Parameters
name Tag name
value Tag content, as a string or null to remove the sub-element

public void setValue (String value)

Sets the attribute value, as a string.

Parameters
value Attribute value

public String toString ()

Generates a string representation of this attribute. The output of this method is in no particular format.

Returns
  • a string representation