I have a model for which one of the setters is expecting a Color Resource but it is not to able use said resource directly without it being resolved (by making use of ContextCompat).
Is there a way that I can annotate my method to indicate/restrict this?
public class SimpleModel {
private String name;
private int bgColor;
private int bgImage;
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
public int getBgColor() {
return bgColor;
}
public void setBgColor(@ColorInt final int bgColor) {
this.bgColor = bgColor;
}
public int getBgImage() {
return bgImage;
}
public void setBgImage(@DrawableRes final int bgImage) {
this.bgImage = bgImage;
}
}
I'm aware of @ColorRes
and @ColorInt
-- but they don't fully resolve my issue.
Is this something that an annotation can take care of for me? What about JavaDocs?
If not -- how can I check that the resource being passed is usable?