public boolean hasMethodAnnotation(Class<? extends Annotation> annotation, String propertyName, M getter, M setter, Locatable srcPos) { boolean x = ( getter != null && hasMethodAnnotation(annotation, getter) ); boolean y = ( setter != null && hasMethodAnnotation(annotation, setter) ); if(x && y) { // both are present. have getMethodAnnotation report an error getMethodAnnotation(annotation,getter,setter,srcPos); } return x||y; }
public final <A extends Annotation> A getMethodAnnotation(Class<A> annotation, M getter, M setter, Locatable srcPos) { A a1 = getter==null?null:getMethodAnnotation(annotation,getter,srcPos); A a2 = setter==null?null:getMethodAnnotation(annotation,setter,srcPos); if(a1==null) { if(a2==null) return null; else return a2; } else { if(a2==null) return a1; else { // both are present getErrorHandler().error(new IllegalAnnotationException( Messages.DUPLICATE_ANNOTATIONS.format( annotation.getName(), fullName(getter),fullName(setter)), a1, a2 )); // recover by ignoring one of them return a1; } } }
public boolean hasMethodAnnotation(Class<? extends Annotation> annotation, String propertyName, M getter, M setter, Locatable srcPos) { boolean x = ( getter != null && hasMethodAnnotation(annotation, getter) ); boolean y = ( setter != null && hasMethodAnnotation(annotation, setter) ); if(x && y) { // both are present. have getMethodAnnotation report an error getMethodAnnotation(annotation,getter,setter,srcPos); } return x||y; }
public final <A extends Annotation> A getMethodAnnotation(Class<A> annotation, M getter, M setter, Locatable srcPos) { A a1 = getter==null?null:getMethodAnnotation(annotation,getter,srcPos); A a2 = setter==null?null:getMethodAnnotation(annotation,setter,srcPos); if(a1==null) { if(a2==null) return null; else return a2; } else { if(a2==null) return a1; else { // both are present getErrorHandler().error(new IllegalAnnotationException( Messages.DUPLICATE_ANNOTATIONS.format( annotation.getName(), fullName(getter),fullName(setter)), a1, a2 )); // recover by ignoring one of them return a1; } } }
public boolean hasMethodAnnotation(Class<? extends Annotation> annotation, String propertyName, M getter, M setter, Locatable srcPos) { boolean x = ( getter != null && hasMethodAnnotation(annotation, getter) ); boolean y = ( setter != null && hasMethodAnnotation(annotation, setter) ); if(x && y) { // both are present. have getMethodAnnotation report an error getMethodAnnotation(annotation,getter,setter,srcPos); } return x||y; }
public boolean hasMethodAnnotation(Class<? extends Annotation> annotation, String propertyName, M getter, M setter, Locatable srcPos) { boolean x = ( getter != null && hasMethodAnnotation(annotation, getter) ); boolean y = ( setter != null && hasMethodAnnotation(annotation, setter) ); if(x && y) { // both are present. have getMethodAnnotation report an error getMethodAnnotation(annotation,getter,setter,srcPos); } return x||y; }
public final <A extends Annotation> A getMethodAnnotation(Class<A> annotation, M getter, M setter, Locatable srcPos) { A a1 = getter==null?null:getMethodAnnotation(annotation,getter,srcPos); A a2 = setter==null?null:getMethodAnnotation(annotation,setter,srcPos); if(a1==null) { if(a2==null) return null; else return a2; } else { if(a2==null) return a1; else { // both are present getErrorHandler().error(new IllegalAnnotationException( Messages.DUPLICATE_ANNOTATIONS.format( annotation.getName(), fullName(getter),fullName(setter)), a1, a2 )); // recover by ignoring one of them return a1; } } }
public final <A extends Annotation> A getMethodAnnotation(Class<A> annotation, M getter, M setter, Locatable srcPos) { A a1 = getter==null?null:getMethodAnnotation(annotation,getter,srcPos); A a2 = setter==null?null:getMethodAnnotation(annotation,setter,srcPos); if(a1==null) { if(a2==null) return null; else return a2; } else { if(a2==null) return a1; else { // both are present getErrorHandler().error(new IllegalAnnotationException( Messages.DUPLICATE_ANNOTATIONS.format( annotation.getName(), fullName(getter),fullName(setter)), a1, a2 )); // recover by ignoring one of them return a1; } } }