But I don't know if it can be done. I have an instance of Element class from javax.lang.model.element packpage in my annotation processor. I can do element.asType() to get the type of my property, but I don't know how to check if this property is optional or not.