Is there any annotation to let us get another value if original value is null?
@Getter
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class SomeDto extends BaseDto {
private BigDecimal a;
@GetOrAlternative(alternative = "a")
private BigDecimal b;
For example, I want to get value a if b is null on above code. I want to use that like dto.getBOrAlternative(). Is that possible? If that is not possible, how can I implement that?
I tried to make custom annotation and processor following this: https://www.happykoo.net/@happykoo/posts/256 However, it didn't work. I think it is because that is not a field level.