yarfraw.core.datamodel
Class Image

java.lang.Object
  extended by yarfraw.core.datamodel.Image
All Implemented Interfaces:
Serializable

public class Image
extends Object

  • Rss 2.0 - Image is an optional sub-element of Image, which contains three required and three optional sub-elements.

    url is the URI of a GIF, JPEG or PNG image that represents the channel.

    title describes the image, it's used in the ALT attribute of the HTML <img> tag when the channel is rendered in HTML.

    link is the URI of the site, when the channel is rendered, the image is a link to the site. (Note, in practice the image <title> and <link> should have the same value as the channel's <title> and <link>.

    Optional elements include width and height, indicating the width and height of the image in pixels.

    description contains text that is included in the TITLE attribute of the link formed around the image in the HTML rendering.

    Maximum value for width is 144, default value is 88. Maximum value for height is 400, default value is 31.

  • Rss 1.0 - An image to be associated with an HTML rendering of the channel. This image should be of a format supported by the majority of Web browsers. While the later 0.91 specification allowed for a width of 1-144 and height of 1-400, convention (and the 0.9 specification) dictate 88x31.
  • Atom 1.0 - The "atom:icon" element's content is an IRI reference [RFC3987] which identifies an image which provides iconic visual identification for a feed.
    The "atom:logo" element's content is an IRI reference [RFC3987] which identifies an image which provides visual identification for a feed.
  • Author:
    jliang
    See Also:
    Serialized Form

    Field Summary
    protected  String _about
               
    protected  String _base
               
    protected  String _lang
               
    protected  Map<QName,String> _otherAttributes
               
    protected  List<Element> _otherElements
               
    protected  String _resource
               
     
    Constructor Summary
    Image()
               
    Image(String url, String title, String link, Integer width, Integer height, String description)
               
     
    Method Summary
     Image addOtherAttributes(QName namespace, String attribute)
              Add an attribute that is not in the RSS 2.0 specs.
     boolean equals(Object other)
               
     String getAbout()
              This maps to the required 'about' attribute that present of all second level elements (channel, image, item, and textinput).
     String getAttributeValueByLocalName(String localName)
              Search for attributes that are not in the spec by its local name.
     String getAttributeValueByQName(QName name)
              Search for attributes that are not in the spec by its QName.
     String getBase()
              This maps to the 'base' attribute that is common in all Atom 1.0 elements.
     String getDescription()
              This field is only used by Rss 2.0, it is ignored by other FeedFormat
    description contains text that is included in the TITLE attribute of the link formed around the image in the HTML rendering.
     Element getElementByLocalName(String localName)
              Search through the other element list and return the FIRST element that matches the input localName.
     Element getElementByNS(String namespaceURI, String localName)
              Search through the other element list and return the first element that matches both input the namespaceURI and the localName.
     Integer getHeight()
              This field is only used by Rss 2.0, it is ignored by other FeedFormat
    Optional elements include width and height, indicating the width and height of the image in pixels.
     String getLang()
              The language attribute indicates the language that is used by the enclosed element.
     Locale getLangAsLocale()
              The language attribute indicates the language that is used by the enclosed element.
     String getLink()
               Rss 2.0 - link is the URI of the site, when the channel is rendered, the image is a link to the site.
     Map<QName,String> getOtherAttributes()
              Any other attribute that is not in the RSS specs.
     List<Element> getOtherElements()
              Other additional elements that are not in the Rss specs.
     String getResource()
              This maps to the optional 'resource' attribute that present in some Rss 1.0 elements.
     String getTitle()
              Rss 2.0 - title describes the image, it's used in the ALT attribute of the HTML <img> tag when the channel is rendered in HTML.
     String getUrl()
              Rss 2.0 - url is the URI of a GIF, JPEG or PNG image that represents the channel.
     Integer getWidth()
              This field is only used by Rss 2.0, it is ignored by other FeedFormat
    Optional elements include width and height, indicating the width and height of the image in pixels.
     int hashCode()
               
     Image setAbout(String about)
              Rss 1.0 only
     Image setBase(String base)
              Atom 1.0 only
    Any element defined by this specification MAY have an xml:base attribute [W3C.REC-xmlbase-20010627].
     Image setDescription(String description)
              This field is only used by Rss 2.0, it is ignored by other FeedFormat
    description contains text that is included in the TITLE attribute of the link formed around the image in the HTML rendering.
     Image setHeight(Integer height)
              This field is only used by Rss 2.0, it is ignored by other FeedFormat
    Optional elements include width and height, indicating the width and height of the image in pixels.
     Image setLang(Locale lang)
              Rss 2.0 - <language> element.
     Image setLang(String lang)
              Rss 2.0 - <language> element.
     Image setLink(String link)
               Rss 2.0 - link is the URI of the site, when the channel is rendered, the image is a link to the site.
     Image setOtherAttributes(Map<QName,String> otherAttributes)
              Any other attribute that is not in the RSS 2.0 specs.
     Image setResource(String resource)
              Rss 1.0 only
     Image setTitle(String title)
              Rss 2.0 - title describes the image, it's used in the ALT attribute of the HTML <img> tag when the channel is rendered in HTML.
     Image setUrl(String url)
              Rss 2.0 - url is the URI of a GIF, JPEG or PNG image that represents the channel.
     Image setWidth(Integer width)
              This field is only used by Rss 2.0, it is ignored by other FeedFormat
    Optional elements include width and height, indicating the width and height of the image in pixels.
     String toString()
               
     void validate(FeedFormat format)
               
     
    Methods inherited from class java.lang.Object
    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
     

    Field Detail

    _base

    protected String _base

    _lang

    protected String _lang

    _resource

    protected String _resource

    _about

    protected String _about

    _otherAttributes

    protected Map<QName,String> _otherAttributes

    _otherElements

    protected List<Element> _otherElements
    Constructor Detail

    Image

    public Image()

    Image

    public Image(String url,
                 String title,
                 String link,
                 Integer width,
                 Integer height,
                 String description)
    Method Detail

    setUrl

    public Image setUrl(String url)
  • Rss 2.0 - url is the URI of a GIF, JPEG or PNG image that represents the channel. if url is not an valid url
  • Rss 1.0 - The URL of the image to used in the "src" attribute of the channel's image tag when rendered as HTML.
  • Atom 1.0 - url of the image
  • Parameters:
    url - - any valid url
    Returns:
    this

    getTitle

    public String getTitle()
  • Rss 2.0 - title describes the image, it's used in the ALT attribute of the HTML <img> tag when the channel is rendered in HTML.
  • Rss 1.0 - The alternative text ("alt" attribute) associated with the channel's image tag when rendered as HTML.
  • Atom 1.0 - not supported, this field is ignored.

  • setTitle

    public Image setTitle(String title)
  • Rss 2.0 - title describes the image, it's used in the ALT attribute of the HTML <img> tag when the channel is rendered in HTML.
  • Rss 1.0 - The alternative text ("alt" attribute) associated with the channel's image tag when rendered as HTML.
  • Atom 1.0 - not supported, this field is ignored.
  • Parameters:
    title - - string value of the title
    Returns:
    this

    setLink

    public Image setLink(String link)
  • Rss 2.0 - link is the URI of the site, when the channel is rendered, the image is a link to the site. (Note, in practice the image <title> and <link> should have the same value as the channel's <title> and <link>.
  • Rss 1.0 - The URL to which an HTML rendering of the channel image will link. This, as with the channel's title link, is commonly the parent site's home or news page.
  • Atom 1.0 - not supported, this field is ignored.

  • getUrl

    public String getUrl()
  • Rss 2.0 - url is the URI of a GIF, JPEG or PNG image that represents the channel. if url is not an valid url
  • Rss 1.0 - The URL of the image to used in the "src" attribute of the channel's image tag when rendered as HTML.
  • Atom 1.0 - url of the image
  • Returns:
    url of the image

    getLink

    public String getLink()
  • Rss 2.0 - link is the URI of the site, when the channel is rendered, the image is a link to the site. (Note, in practice the image <title> and <link> should have the same value as the channel's <title> and <link>.
  • Rss 1.0 - The URL to which an HTML rendering of the channel image will link. This, as with the channel's title link, is commonly the parent site's home or news page.
  • Atom 1.0 - not supported, this field is ignored.
  • Returns:

    getWidth

    public Integer getWidth()
    This field is only used by Rss 2.0, it is ignored by other FeedFormat
    Optional elements include width and height, indicating the width and height of the image in pixels.


    setWidth

    public Image setWidth(Integer width)
    This field is only used by Rss 2.0, it is ignored by other FeedFormat
    Optional elements include width and height, indicating the width and height of the image in pixels. Maximum value for width is 144, default value is 88.


    getHeight

    public Integer getHeight()
    This field is only used by Rss 2.0, it is ignored by other FeedFormat
    Optional elements include width and height, indicating the width and height of the image in pixels.


    setHeight

    public Image setHeight(Integer height)
    This field is only used by Rss 2.0, it is ignored by other FeedFormat
    Optional elements include width and height, indicating the width and height of the image in pixels. Maximum value for height is 400, default value is 31.


    getDescription

    public String getDescription()
    This field is only used by Rss 2.0, it is ignored by other FeedFormat
    description contains text that is included in the TITLE attribute of the link formed around the image in the HTML rendering.


    setDescription

    public Image setDescription(String description)
    This field is only used by Rss 2.0, it is ignored by other FeedFormat
    description contains text that is included in the TITLE attribute of the link formed around the image in the HTML rendering.


    setOtherAttributes

    public Image setOtherAttributes(Map<QName,String> otherAttributes)
    Any other attribute that is not in the RSS 2.0 specs.


    addOtherAttributes

    public Image addOtherAttributes(QName namespace,
                                    String attribute)
    Add an attribute that is not in the RSS 2.0 specs.


    setBase

    public Image setBase(String base)
    Atom 1.0 only
    Any element defined by this specification MAY have an xml:base attribute [W3C.REC-xmlbase-20010627]. When xml:base is used in an Atom Document, it serves the function described in section 5.1.1 of [RFC3986], establishing the base URI (or IRI) for resolving any relative references found within the effective scope of the xml:base attribute.

    Parameters:
    base -
    Returns:

    setLang

    public Image setLang(String lang)
  • Rss 2.0 - <language> element. The language the channel is written in. This allows aggregators to group all Italian language sites, for example, on a single page. A list of allowable values for this element, as provided by Netscape, is here. You may also use values defined by the W3C. Only <channel> support this element.
  • Rss 1.0 - <dc:language> element. A language of the intellectual content of the resource. Only <channel> and <item> support this element.
  • Atom 1.0 - 'lang' attribute

  • Note: for Rss 2.0 and Rss 1.0, only <channel> and <item>

    Parameters:
    lang -
    Returns:

    setLang

    public Image setLang(Locale lang)
  • Rss 2.0 - <language> element. The language the channel is written in. This allows aggregators to group all Italian language sites, for example, on a single page. A list of allowable values for this element, as provided by Netscape, is here. You may also use values defined by the W3C. Only <channel> support this element.
  • Rss 1.0 - <dc:language> element. A language of the intellectual content of the resource. Only <channel> and <item> support this element.
  • Atom 1.0 - 'lang' attribute

  • Note: for Rss 2.0 and Rss 1.0, only <channel> and <item>

    Parameters:
    lang -
    Returns:

    setResource

    public Image setResource(String resource)
    Rss 1.0 only

    Parameters:
    resource -
    Returns:

    setAbout

    public Image setAbout(String about)
    Rss 1.0 only

    Parameters:
    about -
    Returns:

    validate

    public void validate(FeedFormat format)
                  throws ValidationException
    Throws:
    ValidationException

    getBase

    public String getBase()
    This maps to the 'base' attribute that is common in all Atom 1.0 elements. Other FeedFormat will ignore this attribute.

    Returns:
    - attribute value.

    getLang

    public String getLang()
    The language attribute indicates the language that is used by the enclosed element.

    Returns:
    - attribute value.

    getLangAsLocale

    public Locale getLangAsLocale()
    The language attribute indicates the language that is used by the enclosed element.

    Returns:
    - a new Locale Object by parsing the lang attribute.

    getResource

    public String getResource()
    This maps to the optional 'resource' attribute that present in some Rss 1.0 elements. Other FeedFormat will ignore this attribute.

    Returns:
    - attribute value.

    getAbout

    public String getAbout()
    This maps to the required 'about' attribute that present of all second level elements (channel, image, item, and textinput). Other FeedFormat will ignore this attribute.

    Returns:
    - attribute value.

    getOtherElements

    public List<Element> getOtherElements()
    Other additional elements that are not in the Rss specs.


    getElementByNS

    public Element getElementByNS(String namespaceURI,
                                  String localName)
    Search through the other element list and return the first element that matches both input the namespaceURI and the localName.

    Parameters:
    namespaceURI - - namespaceURI of the element to be search for
    localName - - localName of the element
    Returns:
    - null if no matching element is found, the matching element otherwise.

    getElementByLocalName

    public Element getElementByLocalName(String localName)
    Search through the other element list and return the FIRST element that matches the input localName.

    Parameters:
    localName - - localName of the element
    Returns:
    - null if no matching element is found, the matching element otherwise.

    getOtherAttributes

    public Map<QName,String> getOtherAttributes()
    Any other attribute that is not in the RSS specs.


    getAttributeValueByLocalName

    public String getAttributeValueByLocalName(String localName)
    Search for attributes that are not in the spec by its local name.

    Parameters:
    localName - localName of the attribute
    Returns:
    null if attribute is not found, the value of the attribute otherwise

    getAttributeValueByQName

    public String getAttributeValueByQName(QName name)
    Search for attributes that are not in the spec by its QName.

    Parameters:
    name - QName of the attribute
    Returns:
    null if attribute is not found, the value of the attribute otherwise

    toString

    public String toString()
    Overrides:
    toString in class Object

    equals

    public boolean equals(Object other)
    Overrides:
    equals in class Object

    hashCode

    public int hashCode()
    Overrides:
    hashCode in class Object


    Copyright © 2008. All Rights Reserved.