com.google.api.gbase.client
Class GoogleBaseAttribute

java.lang.Object
  extended by com.google.api.gbase.client.GoogleBaseAttribute

public class GoogleBaseAttribute
extends java.lang.Object

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


Constructor Summary
GoogleBaseAttribute(GoogleBaseAttributeId attributeId, java.lang.String textValue)
          Creates a new Extension attribute with an GoogleBaseAttributeId and string content.
GoogleBaseAttribute(java.lang.String name)
          Creates a new GoogleBaseAttribute with a name and no type.
GoogleBaseAttribute(java.lang.String name, GoogleBaseAttributeType type)
          Creates a new GoogleBaseAttribute with a name and type.
GoogleBaseAttribute(java.lang.String name, GoogleBaseAttributeType type, boolean privateAccess)
          Creates a new GoogleBaseAttribute with a name and type.
GoogleBaseAttribute(java.lang.String name, GoogleBaseAttributeType type, boolean privateAccess, java.lang.String textValue)
          Creates a new Extension attribute with a name, type and string content.
GoogleBaseAttribute(java.lang.String name, GoogleBaseAttributeType type, java.lang.String textValue)
          Creates a new Extension attribute with a name, type and string content.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 Adjustments getAdjustments()
          Gets the adjustments for this attribute.
 GoogleBaseAttributeId getAttributeId()
          Returns the attribute identity, name and type.
 java.lang.String getName()
          Gets the attribute name.
 java.util.Collection<? extends java.lang.String> getSubElementNames()
          Gets the name of all sub-elements in this attribute.
 java.lang.String getSubElementValue(java.lang.String name)
          Gets the value of a sub-tag.
 java.util.List<Thumbnail> getThumbnails()
          Gets the reference to the list of thumbnails for this attribute.
 GoogleBaseAttributeType getType()
          Gets the type of the attribute, or null.
 java.lang.String getValueAsString()
          Gets the attribute value, as a string (or null).
 boolean hasAdjustments()
           
 int hashCode()
           
 boolean hasSubElement(java.lang.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.
 boolean isPrivate()
          Checks whether the attribute should only be shown to the owner of this item.
 void removeSubElement(java.lang.String name)
          Removes a sub-element.
 void setPrivate(boolean privateAccess)
          Declares the attribute as being private or public (the default).
 void setSubElement(java.lang.String name, java.lang.String value)
          Sets the value of a sub-tag.
 void setValue(java.lang.String value)
          Sets the attribute value, as a string.
 java.lang.String toString()
          Generates a string representation of this attribute.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GoogleBaseAttribute

public GoogleBaseAttribute(java.lang.String name)
Creates a new GoogleBaseAttribute with a name and no type.

Parameters:
name -

GoogleBaseAttribute

public GoogleBaseAttribute(java.lang.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

GoogleBaseAttribute

public GoogleBaseAttribute(java.lang.String name,
                           GoogleBaseAttributeType type,
                           java.lang.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:
java.lang.NullPointerException - if argument name is null

GoogleBaseAttribute

public GoogleBaseAttribute(java.lang.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

GoogleBaseAttribute

public GoogleBaseAttribute(java.lang.String name,
                           GoogleBaseAttributeType type,
                           boolean privateAccess,
                           java.lang.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:
java.lang.NullPointerException - if argument name is null

GoogleBaseAttribute

public GoogleBaseAttribute(GoogleBaseAttributeId attributeId,
                           java.lang.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:
java.lang.NullPointerException - if argument name is null
Method Detail

toString

public java.lang.String toString()
Generates a string representation of this attribute. The output of this method is in no particular format.

Overrides:
toString in class java.lang.Object
Returns:
a string representation

getName

public java.lang.String getName()
Gets the attribute name.


getType

public GoogleBaseAttributeType getType()
Gets the type of the attribute, or null.


getAttributeId

public GoogleBaseAttributeId getAttributeId()
Returns the attribute identity, name and type.

Returns:
attribute name and type

getValueAsString

public java.lang.String getValueAsString()
Gets the attribute value, as a string (or null).


isPrivate

public boolean isPrivate()
Checks whether the attribute should only be shown to the owner of this item.


setPrivate

public void setPrivate(boolean privateAccess)
Declares the attribute as being private or public (the default).

Parameters:
privateAccess -

setValue

public void setValue(java.lang.String value)
Sets the attribute value, as a string.

Parameters:
value - attribute value

hasValue

public boolean hasValue()
Returns true if the attribute has some text content.


hasSubElements

public boolean hasSubElements()
Returns true if the attribute has sub-tags.


setSubElement

public void setSubElement(java.lang.String name,
                          java.lang.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

getSubElementValue

public java.lang.String getSubElementValue(java.lang.String name)
Gets the value of a sub-tag.

Parameters:
name -
Returns:
sub-tag text content or null

hasSubElement

public boolean hasSubElement(java.lang.String name)
Checks whether a specific sub-element exists.

Parameters:
name - element name
Returns:
true if the sub-element exists

removeSubElement

public void removeSubElement(java.lang.String name)
Removes a sub-element.

Parameters:
name - element names

getSubElementNames

public java.util.Collection<? extends java.lang.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

hasAdjustments

public boolean hasAdjustments()

getAdjustments

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.

hasThumbnails

public boolean hasThumbnails()
Returns true if the attribute has thumbnails, false otherwise.


getThumbnails

public java.util.List<Thumbnail> getThumbnails()
Gets the reference to the list of thumbnails for this attribute. The result might be empty, but never null.


hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object