Class TopUpParser
java.lang.Object
com.microblink.blinkinput.entities.Entity<T>
com.microblink.blinkinput.entities.parsers.Parser<TopUpParser.Result>
com.microblink.blinkinput.entities.parsers.topup.TopUpParser
- All Implemented Interfaces:
android.os.Parcelable
A parser that can extract TopUp (mobile phone coupon) codes from OCR result.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from class com.microblink.blinkinput.entities.parsers.Parser
CLASS_NAMEFields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClears parser result.clone()Create a copy of the entity.voidconsumeResult(TopUpParser.Result resultToConsume) Consumes given result.voidconsumeResultFrom(Entity other) Consume result from other entity.protected voiddeserializeNativeSettings(byte[] serializedSettings) protected byte[]voidsetAllowNoPrefix(boolean allowNoPrefix) Indicates whether USSD codes without prefix are allowed.voidsetPrefixAndUssdCodeLength(String prefix, int ussdCodeLength) Sets the given top up prefix and USSD code length.voidsetReturnCodeWithoutPrefix(boolean returnCodeWithoutPrefix) Indicates whether*digits*prefix and#at the end of scanned USSD code will be returned.voidsetTopUpPreset(TopUpPreset preset) Sets the top up prefix and USSD code length based on the givenTopUpPreset.booleanIndicates whether USSD codes without prefix are allowed.booleanIndicates whether*digits*prefix and#at the end of scanned USSD code will be returned.protected voidterminateNative(long nativeContext) Methods inherited from class com.microblink.blinkinput.entities.parsers.Parser
getPriority, isRequired, setRequiredMethods inherited from class com.microblink.blinkinput.entities.Entity
describeContents, finalize, getNativeContext, getResult, nativeGetNativeResultContext, readFromParcel, writeToParcel
-
Field Details
-
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
Sets the top up prefix and USSD code length based on the givenTopUpPreset. 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
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 prefixussdCodeLength- length of the USSD code
-
terminateNative
protected void terminateNative(long nativeContext) - Specified by:
terminateNativein classEntity<TopUpParser.Result>
-
serializeNativeSettings
@Nullable protected byte[] serializeNativeSettings()- Specified by:
serializeNativeSettingsin classEntity<TopUpParser.Result>
-
deserializeNativeSettings
protected void deserializeNativeSettings(@NonNull byte[] serializedSettings) - Specified by:
deserializeNativeSettingsin classEntity<TopUpParser.Result>
-
clone
Description copied from class:EntityCreate 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 theRecognizerRunnerVieworRecognizerRunnerwith the updated entity hierarchy.- Specified by:
clonein classEntity<TopUpParser.Result>- Returns:
- a copy of the entity
-
consumeResultFrom
Description copied from class:EntityConsume result from other entity. The result from other will be put instead current result of this entity. This method is used insideBaseIntentTransferable.loadFromIntent(Intent)and similar methods to replace the result content of the saved entities with results that have arrived overIntent- Specified by:
consumeResultFromin classEntity<TopUpParser.Result>- Parameters:
other- Entity from which result should be consumed.
-
consumeResult
Description copied from class:ParserConsumes given result. The given result will be put instead current result of this entity.- Specified by:
consumeResultin classParser<TopUpParser.Result>- Parameters:
resultToConsume- Result that should be consumed.
-
clearResult
public void clearResult()Description copied from class:ParserClears parser result.- Specified by:
clearResultin classParser<TopUpParser.Result>
-