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
Nested Classes Modifier and Type Class Description static class
ItemPropValue.Type
Supported types.
-
Constructor Summary
Constructors Constructor Description ItemPropValue(Object content, ItemPropValue.Type type)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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()
-
-
-
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
-
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 nestedItemScope
.
-
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
iftype == 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.
-
toJSON
public String toJSON()
-
-