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 classItemPropValue.TypeSupported 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 booleanequals(Object obj)static StringformatDateTime(Date in)DategetAsDate()floatgetAsFloat()intgetAsInteger()URLgetAsLink()ItemScopegetAsNested()ObjectgetContent()ItemPropValue.TypegetType()inthashCode()booleanisDate()booleanisFloat()booleanisInteger()booleanisLink()booleanisNested()booleanisNumber()booleanisPlain()static DateparseDateTime(String dateStr)StringtoJSON()StringtoString()
-
-
-
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:
trueif type is plain text.
-
isLink
public boolean isLink()
- Returns:
trueif type is a link.
-
isDate
public boolean isDate()
- Returns:
trueif type is a date.
-
isNested
public boolean isNested()
- Returns:
trueif type is a nestedItemScope.
-
isInteger
public boolean isInteger()
- Returns:
trueif type is an integer.
-
isFloat
public boolean isFloat()
- Returns:
trueif type is a float.
-
isNumber
public boolean isNumber()
- Returns:
trueif 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
Dateiftype == 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()
-
-