@Retention(value=RUNTIME) public @interface Prop
Modifier and Type | Optional Element and Description |
---|---|
String |
docString |
boolean |
optional
Whether this prop can be omitted by the caller to the component, making it take its default
value.
|
ResType |
resType
Marks this prop as one that corresponding to a specific Android resource type, and therefore
generates various helper methods to initialize it.
|
String |
varArg
Marks this prop as one supporting a variable number of arguments, and therefore adds methods
to make it easier to build lists of this argument.
|
public abstract boolean optional
PropDefault
and named the same as the prop is in the class it will override the
default value.public abstract ResType resType
CharSequence
prop named "title" may be marked as ResType.STRING
.
This will make the component have not only method "title(CharSequence)" but also various
methods that enable initializing the prop from a resource or attribute:
titleRes(@StringRes int resId)
titleRes(@StringRes int resId, Object... formatArgs)
titleAttr(@AttrRes int attrResId, @StringRes int defResId)
titleAttr(@AttrRes int attrResId)
public abstract String docString
public abstract String varArg
@Prop(@varArg="name") List<CharSequence> names
would generate
an name
method which can be called multiple times to add a set of names. These props
should be a parameterized list with a resource type of resType = ResType.NONE
.