Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.any23.extractor.microdata
Class ItemPropValue

    java.lang.Object
      org.apache.any23.extractor.microdata.ItemPropValue

    public class ItemPropValue

extends Object

Describes a possible value for a Microdata item property.

Author:
  Michele Mostarda (mostarda@fbk.eu)

Nested Class Summary
`static class` | `ItemPropValue.Type` Supported types.

Constructor Summary
`ItemPropValue(Object content, ItemPropValue.Type type)` Constructor.

Method Summary
`boolean` | `equals(Object obj)`
`static String` | `formatDateTime(Date in)`
`Date` | `getAsDate()`
`float` | `getAsFloat()`
`int` | `getAsInteger()`
`URL` | `getAsLink()`
`ItemScope` | `getAsNested()`
`Object` | `getContent()`
`ItemPropValue.Type` | `getType()`
`int` | `hashCode()`
`boolean` | `isDate()`
`boolean` | `isFloat()`
`boolean` | `isInteger()`
`boolean` | `isLink()`
`boolean` | `isNested()`
`boolean` | `isNumber()`
`boolean` | `isPlain()`
`static Date` | `parseDateTime(String dateStr)`
`String` | `toJSON()`
`String` | `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### ItemPropValue

    public ItemPropValue(Object content,
                         ItemPropValue.Type type)

  Constructor.

  Parameters:
    `content` - content object.
    `type` - content type.

Method Detail

### parseDateTime

    public static Date parseDateTime(String dateStr)
                              throws ParseException

  Throws:
    `ParseException`

### formatDateTime

    public static String formatDateTime(Date in)

### getContent

    public Object getContent()

  Returns:
    the content object.

### getType

    public ItemPropValue.Type getType()

  Returns:
    the content type.

### isPlain

    public boolean isPlain()

  Returns:
    `true` if type is plain text.

### isLink

    public boolean isLink()

  Returns:
    `true` if type is a link.

### isDate

    public boolean isDate()

  Returns:
    `true` if type is a date.

### isNested

    public boolean isNested()

  Returns:
    `true` if type is a nested `ItemScope`.

### isInteger

    public boolean isInteger()

  Returns:
    `true` if type is an integer.

### isFloat

    public boolean isFloat()

  Returns:
    `true` if type is a float.

### isNumber

    public boolean isNumber()

  Returns:
    `true` if type is a number.

### getAsInteger

    public int getAsInteger()

  Returns:
    the content value as integer, or raises an exception.
  Throws:
    `NumberFormatException` - if the content is not an integer.
    `ClassCastException` - if content is not plain.

### getAsFloat

    public float getAsFloat()

  Returns:
    the content value as float, or raises an exception.
  Throws:
    `NumberFormatException` - if the content is not an float.
    `ClassCastException` - if content is not plain.

### getAsDate

    public Date getAsDate()

  Returns:
    the content as `Date` if `type == Type.DateTime`,
  Throws:
    `ClassCastException` - if content is not a valid date.

### getAsLink

    public URL getAsLink()

  Returns:
    the content value as URL, or raises an exception.
  Throws:
    `MalformedURLException` - if the content is not a valid URL.
    `ClassCastException` - if content is not a link.

### getAsNested

    public ItemScope getAsNested()

  Returns:
    the content value as `ItemScope`.
  Throws:
    `ClassCastException` - if the content is not a valid nested item.

### toJSON

    public String toJSON()

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.