public class Investor {
final String name;
int id ;
public Investor(String name, int id) {
super();
this.name = name;
this.id = id;
}
@MaskName
public String getName() {
return name;
}
public int getId() {
return id;
}
this is my POJO.
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
public @interface MaskName {
}
this is my annotation
what I want to do is :place a mask annotation on Getter method of my pojo and want the getter to return some different value than the object's field , say my investor name is "Mike" , but i have put a MaskName annotation on it , so whenever i would call the getInvestorName() method it should return me a masked value (xxxx) .
How can I achieve this , is it possible to achieve this using custom annotation