All Implemented Interfaces:
android.os.Parcelable

public final class TopUpParser extends Parser<TopUpParser.Result>
A parser that can extract TopUp (mobile phone coupon) codes from OCR result.
  • Field Details

    • CREATOR

      public static final android.os.Parcelable.Creator<TopUpParser> CREATOR
  • Constructor Details

    • TopUpParser

      public TopUpParser()
  • Method Details

    • setReturnCodeWithoutPrefix

      public void setReturnCodeWithoutPrefix(boolean returnCodeWithoutPrefix)
      Indicates whether *digits* prefix and # at the end of scanned USSD code will be returned. By default, this is set to 'false'
    • shouldReturnCodeWithoutPrefix

      public boolean shouldReturnCodeWithoutPrefix()
      Indicates whether *digits* prefix and # at the end of scanned USSD code will be returned. By default, this is set to 'false'
    • setAllowNoPrefix

      public void setAllowNoPrefix(boolean allowNoPrefix)
      Indicates whether USSD codes without prefix are allowed. By default, this is set to 'false'
    • shouldAllowNoPrefix

      public boolean shouldAllowNoPrefix()
      Indicates whether USSD codes without prefix are allowed. By default, this is set to 'false'
    • setTopUpPreset

      public void setTopUpPreset(@NonNull TopUpPreset preset)
      Sets the top up prefix and USSD code length based on the given TopUpPreset. Only top ups with the chosen prefix and USSD code length in form *<prefixString>*<USSDCodeLength digits># will be parsed. If top up prefix and USSD code length is not set, top ups with any prefix and USSD code length can be parsed.
      Parameters:
      preset - preset that determines top up prefix and USSD code length that will be set.
    • setPrefixAndUssdCodeLength

      public void setPrefixAndUssdCodeLength(@NonNull String prefix, int ussdCodeLength)
      Sets the given top up prefix and USSD code length. Only top ups with the chosen prefix and USSD code length in form *<prefixString>*<USSDCodeLength digits># will be parsed. If top up prefix and USSD code length is not set, top ups with any prefix and USSD code length can be parsed.
      Parameters:
      prefix - top up prefix
      ussdCodeLength - length of the USSD code
    • terminateNative

      protected void terminateNative(long nativeContext)
      Specified by:
      terminateNative in class Entity<TopUpParser.Result>
    • serializeNativeSettings

      @Nullable protected byte[] serializeNativeSettings()
      Specified by:
      serializeNativeSettings in class Entity<TopUpParser.Result>
    • deserializeNativeSettings

      protected void deserializeNativeSettings(@NonNull byte[] serializedSettings)
      Specified by:
      deserializeNativeSettings in class Entity<TopUpParser.Result>
    • clone

      public TopUpParser clone()
      Description copied from class: Entity
      Create a copy of the entity. This is required if properties of the entity must be modified while background thread performs processing. In order to avoid race conditions, changing properties is not allowed while entity is used in background processing. However, you are able to make a copy of the entity, change properties of it and then update the RecognizerRunnerView or RecognizerRunner with the updated entity hierarchy.
      Specified by:
      clone in class Entity<TopUpParser.Result>
      Returns:
      a copy of the entity
    • consumeResultFrom

      public void consumeResultFrom(@NonNull Entity other)
      Description copied from class: Entity
      Consume result from other entity. The result from other will be put instead current result of this entity. This method is used inside BaseIntentTransferable.loadFromIntent(Intent) and similar methods to replace the result content of the saved entities with results that have arrived over Intent
      Specified by:
      consumeResultFrom in class Entity<TopUpParser.Result>
      Parameters:
      other - Entity from which result should be consumed.
    • consumeResult

      public void consumeResult(@NonNull TopUpParser.Result resultToConsume)
      Description copied from class: Parser
      Consumes given result. The given result will be put instead current result of this entity.
      Specified by:
      consumeResult in class Parser<TopUpParser.Result>
      Parameters:
      resultToConsume - Result that should be consumed.
    • clearResult

      public void clearResult()
      Description copied from class: Parser
      Clears parser result.
      Specified by:
      clearResult in class Parser<TopUpParser.Result>