AppFunctionPatternMatcher


@Retention(value = AnnotationRetention.BINARY)
@Target
annotation AppFunctionPatternMatcher


Declares a android.os.PatternMatcher that string values can match, used in AppFunctionStringValueConstraint.patternMatchers.

When multiple matchers are declared, a value is valid if it matches any of them (logical OR).

The arguments mirror the android.os.PatternMatcher constructor and are translated into one at compile time.

Usage Example:

// Accepts values that start with "acct_" OR consist only of digits.
@AppFunctionDeclaration(isDescribedByKDoc = false)
fun setAccountId(
@AppFunctionStringValueConstraint(
patternMatchers = [
AppFunctionPatternMatcher("acct_", PatternMatcher.PATTERN_PREFIX),
AppFunctionPatternMatcher("[0-9]+", PatternMatcher.PATTERN_ADVANCED_GLOB),
]
)
accountId: String
) {
// Function body
}

Summary

Public constructors

Public properties

String

The pattern string, as passed to android.os.PatternMatcher.

Int

The pattern type: one of the android.os.PatternMatcher.PATTERN_* constants, such as android.os.PatternMatcher.PATTERN_PREFIX or android.os.PatternMatcher.PATTERN_ADVANCED_GLOB.

Public constructors

AppFunctionPatternMatcher

Added in 1.0.0-beta01
AppFunctionPatternMatcher(pattern: String, type: Int)

Public properties

pattern

val pattern: String

The pattern string, as passed to android.os.PatternMatcher.

The pattern is not validated at compile time. If android.os.PatternMatcher rejects it (for example, a malformed android.os.PatternMatcher.PATTERN_ADVANCED_GLOB), the function using it is omitted from agents' search results. If the pattern is on a property of an AppFunctionSerializable, all of the app's functions are omitted.

type

val type: Int

The pattern type: one of the android.os.PatternMatcher.PATTERN_* constants, such as android.os.PatternMatcher.PATTERN_PREFIX or android.os.PatternMatcher.PATTERN_ADVANCED_GLOB.

The type is interpreted by android.os.PatternMatcher on the device, so a type that the device's SDK does not support matches no values.