Class DateResult

  • All Implemented Interfaces:
    android.os.Parcelable, Result

    public class DateResult
    extends java.lang.Object
    implements android.os.Parcelable, Result
    Helper class for obtaining date results.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface android.os.Parcelable

        android.os.Parcelable.ClassLoaderCreator<T extends java.lang.Object>, android.os.Parcelable.Creator<T extends java.lang.Object>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static android.os.Parcelable.Creator<DateResult> CREATOR  
      • Fields inherited from interface android.os.Parcelable

        CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static DateResult createFromDMY​(int day, int month, int year, java.lang.String originalDateString)
      This method is called from native code to build DateResult from native object.
      static DateResult createUnparsed​(java.lang.String originalDateString)
      This method is called from native code to build DateResult from native object, when date has not been successfully parsed from the given originalDateString.
      int describeContents()  
      Date getDate()
      Date getter, if Date representation of date result exists returns it, otherwise returns null.
      java.lang.Object getNativeResult()
      Returns the native java object containing the result.
      java.lang.String getOriginalDateString()
      Returns original string representation of the date which has been extracted from the OCR result.
      java.lang.String getStringResult()
      Returns the string version of the result.
      java.lang.String toString()  
      void writeToParcel​(android.os.Parcel parcel, int i)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • CREATOR

        @NonNull
        public static final android.os.Parcelable.Creator<DateResult> CREATOR
    • Method Detail

      • getOriginalDateString

        @NonNull
        public java.lang.String getOriginalDateString()
        Returns original string representation of the date which has been extracted from the OCR result. If it is successfully parsed to Date object, it can be obtained by using getDate() method.
        Returns:
        original string representation of the date which has been extracted from the OCR result
      • getDate

        @Nullable
        public Date getDate()
        Date getter, if Date representation of date result exists returns it, otherwise returns null. To obtain original date string use getOriginalDateString() method.
        Returns:
        if Date representation of date result exists returns it, otherwise returns null.
      • createFromDMY

        @NonNull
        public static DateResult createFromDMY​(int day,
                                               int month,
                                               int year,
                                               @NonNull
                                               java.lang.String originalDateString)
        This method is called from native code to build DateResult from native object.
        Parameters:
        day - day of the month
        month - month of the year from interval [1,12]
        year - full year
        originalDateString - original string from which native object has been parsed
        Returns:
        DateResult object
      • createUnparsed

        @NonNull
        public static DateResult createUnparsed​(@NonNull
                                                java.lang.String originalDateString)
        This method is called from native code to build DateResult from native object, when date has not been successfully parsed from the given originalDateString.
        Parameters:
        originalDateString - original string from which native object has been created and which has not been successfully parsed to date.
        Returns:
        DateResult object
      • describeContents

        public int describeContents()
        Specified by:
        describeContents in interface android.os.Parcelable
      • writeToParcel

        public void writeToParcel​(@NonNull
                                  android.os.Parcel parcel,
                                  int i)
        Specified by:
        writeToParcel in interface android.os.Parcelable
      • getNativeResult

        @Nullable
        public java.lang.Object getNativeResult()
        Description copied from interface: Result
        Returns the native java object containing the result. For example, for DateResult, this method will return Date object.
        Specified by:
        getNativeResult in interface Result
        Returns:
        the native java object containing the result.
      • getStringResult

        @Nullable
        public java.lang.String getStringResult()
        Description copied from interface: Result
        Returns the string version of the result. For example, for DateResult, this method will return original string from which date was parsed (same as getOriginalDateString().
        Specified by:
        getStringResult in interface Result
        Returns:
        string version of the result
      • toString

        @NonNull
        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object