Class ItemPropValue


  • public class ItemPropValue
    extends Object
    Describes a possible value for a Microdata item property.
    Author:
    Michele Mostarda (mostarda@fbk.eu)
    • Constructor Detail

      • ItemPropValue

        public ItemPropValue​(Object content,
                             ItemPropValue.Type type)
        Constructor.
        Parameters:
        content - content object.
        type - content type.
    • Method Detail

      • formatDateTime

        public static String formatDateTime​(Date in)
      • getContent

        public Object getContent()
        Returns:
        the content object.
      • 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.
      • toJSON

        public String toJSON()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object