Class ValidatingIntent
java.lang.Object
com.streamwide.smartms.lib.template.serialization.ValidatingIntent
An
Intent that's restricted to deserialize
a limited set of classes.
Various accept/reject methods allow for specifying which classes can be deserialized.
-
Constructor Summary
ConstructorsConstructorDescriptionValidatingIntent(android.content.Intent intent) Constructs an object to deserialize the specified intent. -
Method Summary
Modifier and TypeMethodDescriptionAccept class names where the supplied ClassNameMatcher matches for deserialization, unless they are otherwise rejected.Accept the specified classes for deserialization, unless they are otherwise rejected.Accept the wildcard specified classes for deserialization, unless they are otherwise rejected.Accept class names that match the supplied pattern for deserialization, unless they are otherwise rejected.booleancontainsKey(String key) Returns true if the given key is contained in the mapping of this Bundle.Retrieve the general action to be performed, such asIntent.ACTION_VIEW.booleangetBooleanExtra(String name, boolean defaultValue) Retrieve extended data from the intent.android.content.ClipDataandroid.net.UrigetData()Retrieve data this intent is operating on.android.os.BundleRetrieves a map of extended data from the intent.intgetIntExtra(String name, int defaultValue) Retrieve extended data from the intent.android.view.KeyEventgetKeyEvent(String name) <T extends android.os.Parcelable>
ArrayList<T><T extends android.os.Parcelable>
TgetParcelableExtra(String name) getStringExtra(String name) Retrieve extended data from the intent.getType()Retrieve any explicit MIME type included in the intent.booleanhasCategory(String category) Check if a category exists in the intent.voidready()Reject class names where the supplied ClassNameMatcher matches for deserialization, even if they are otherwise accepted.Reject the specified classes for deserialization, even if they are otherwise accepted.Reject the wildcard specified classes for deserialization, even if they are otherwise accepted.Reject class names that match the supplied pattern for deserialization, even if they are otherwise accepted.
-
Constructor Details
-
ValidatingIntent
public ValidatingIntent(@Nullable android.content.Intent intent) Constructs an object to deserialize the specified intent. At least one accept method needs to be called to specify which classes can be deserialized, as by default no classes are accepted.- Parameters:
intent- an intent
-
-
Method Details
-
hasCategory
Check if a category exists in the intent.- Parameters:
category- The category to check.- Returns:
- boolean True if the intent contains the category, else false.
-
getAction
Retrieve the general action to be performed, such asIntent.ACTION_VIEW. The action describes the general way the rest of the information in the intent should be interpreted -- most importantly, what to do with the data returned bygetData().- Returns:
- The action of this intent or null if none is specified.
- Throws:
InvalidClassException
-
getData
Retrieve data this intent is operating on. This URI specifies the name of the data; often it uses the content: scheme, specifying data in a content provider. Other schemes may be handled by specific activities, such as http: by the web browser.- Returns:
- The URI of the data this intent is targeting or null.
- Throws:
InvalidClassException
-
getClipData
- Throws:
InvalidClassException
-
getType
Retrieve any explicit MIME type included in the intent. This is usually null, as the type is determined by the intent data.- Returns:
- If a type was manually set, it is returned; else null is returned.
- Throws:
InvalidClassException
-
getExtras
Retrieves a map of extended data from the intent.- Returns:
- the map of all extras previously added with putExtra(), or null if none have been added.
- Throws:
InvalidClassException- when a non-accepted class is encountered
-
getKeyEvent
@Nullable public android.view.KeyEvent getKeyEvent(@NonNull String name) throws InvalidClassException - Parameters:
name- The name of the desired item.- Returns:
- The value of an item previously added with putExtra(), or null if no Parcelable value was found.
- Throws:
InvalidClassException- when a non-accepted class is encountered
-
getParcelableExtra
@Nullable public <T extends android.os.Parcelable> T getParcelableExtra(@NonNull String name) throws InvalidClassException - Type Parameters:
T- TheKeyEvent- Parameters:
name- The name of the desired item.- Returns:
- The value of an item previously added with putExtra(), or null if no Parcelable value was found.
- Throws:
InvalidClassException- when a non-accepted class is encountered
-
getParcelableArrayListExtra
@Nullable public <T extends android.os.Parcelable> ArrayList<T> getParcelableArrayListExtra(@NonNull String name) throws InvalidClassException - Type Parameters:
T- TheKeyEvent- Parameters:
name- The name of the desired item.- Returns:
- The value of an item previously added with putExtra(), or null if no Parcelable value was found.
- Throws:
InvalidClassException- when a non-accepted class is encountered
-
getIntExtra
Retrieve extended data from the intent.- Parameters:
name- The name of the desired item.defaultValue- the value to be returned if no value of the desired type is stored with the given name.- Returns:
- the value of an item previously added with putExtra(), or the default value if none was found.
- Throws:
InvalidClassException- when a non-accepted class is encountered
-
getBooleanExtra
public boolean getBooleanExtra(@NonNull String name, boolean defaultValue) throws InvalidClassException Retrieve extended data from the intent.- Parameters:
name- The name of the desired item.defaultValue- the value to be returned if no value of the desired type is stored with the given name.- Returns:
- the value of an item previously added with putExtra(), or the default value if none was found.
- Throws:
InvalidClassException- when a non-accepted class is encountered
-
getStringExtra
Retrieve extended data from the intent.- Parameters:
name- The name of the desired item.- Returns:
- the value of an item previously added with putExtra(), or the default value if none was found.
- Throws:
InvalidClassException- when a non-accepted class is encountered
-
containsKey
Returns true if the given key is contained in the mapping of this Bundle.- Parameters:
key- a String key- Returns:
- true if the key is part of the mapping, false otherwise
-
accept
Accept the specified classes for deserialization, unless they are otherwise rejected.- Parameters:
classes- Classes to accept- Returns:
- this object
- Throws:
OperationNotAllowed
-
reject
Reject the specified classes for deserialization, even if they are otherwise accepted.- Parameters:
classes- Classes to reject- Returns:
- this object
- Throws:
OperationNotAllowed
-
accept
Accept the wildcard specified classes for deserialization, unless they are otherwise rejected.- Parameters:
patterns- Wildcard file name patterns as defined byFilenameUtils.wildcardMatch- Returns:
- this object
- Throws:
OperationNotAllowed
-
reject
Reject the wildcard specified classes for deserialization, even if they are otherwise accepted.- Parameters:
patterns- Wildcard file name patterns as defined byFilenameUtils.wildcardMatch- Returns:
- this object
- Throws:
OperationNotAllowed
-
accept
Accept class names that match the supplied pattern for deserialization, unless they are otherwise rejected.- Parameters:
pattern- standard Java regexp- Returns:
- this object
- Throws:
OperationNotAllowed
-
reject
Reject class names that match the supplied pattern for deserialization, even if they are otherwise accepted.- Parameters:
pattern- standard Java regexp- Returns:
- this object
- Throws:
OperationNotAllowed
-
accept
Accept class names where the supplied ClassNameMatcher matches for deserialization, unless they are otherwise rejected.- Parameters:
m- the matcher to use- Returns:
- this object
- Throws:
OperationNotAllowed
-
reject
Reject class names where the supplied ClassNameMatcher matches for deserialization, even if they are otherwise accepted.- Parameters:
m- the matcher to use- Returns:
- this object
- Throws:
OperationNotAllowed
-
ready
public void ready()
-