Class<?> type = element.getReturnType(); try { desc[i] = new AnnotationMember(name, element.getDefaultValue(), type, element); } catch (Throwable t) { desc[i] = new AnnotationMember(name, t, type, element);
/** * Validates contained value against its member definition * and if ok returns the value. * Otherwise, if the value type mismatches definition * or the value itself describes an error, * throws appropriate exception. * <br> Note, this method may return null if this element was constructed * with such value. * * @see #rethrowError() * @see #copyValue() * @return actual valid value or null if no value */ public Object validateValue() throws Throwable { if (tag == ERROR) { rethrowError(); } if (value == NO_VALUE) { return null; } if (elementType == value.getClass() || elementType.isInstance(value)) { // nested annotation value return copyValue(); } else { throw new AnnotationTypeMismatchException(definingMethod, value.getClass().getName()); } }
if (el1.equals(el2)) { continue next; if (otherValue != null) { if (el.tag == AnnotationMember.ARRAY) { if (!el.equalArrayValue(otherValue)) { return false;
/** * New instances should not be created directly, use factory method * {@link #createAnnotation(Class, AnnotationMember[]) createAnnotation()} * instead. * * @param klzz class defining the annotation type * @param values actual element values */ private AnnotationFactory(Class<? extends Annotation> klzz, AnnotationMember[] values) { klazz = klzz; AnnotationMember[] defs = getElementsDescription(klazz); if (values == null) { elements = defs; } else { //merge default and actual values elements = new AnnotationMember[defs.length]; next: for (int i = elements.length - 1; i >= 0; i--) { for (AnnotationMember val : values) { if (val.name.equals(defs[i].name)) { elements[i] = val.setDefinition(defs[i]); continue next; } } elements[i] = defs[i]; } } }
/** * Returns a hash code composed as a sum of hash codes of member elements, * including elements with default values. * @see AnnotationMember#hashCode() */ public int hashCode() { int hash = 0; for (AnnotationMember element : elements) { hash += element.hashCode(); } return hash; }
if (name.equals(that.name) && tag == that.tag) { if (tag == ARRAY) { return equalArrayValue(that.value); } else if (tag == ERROR) {
throw new IllegalArgumentException(method.toString()); } else { Object value = element.validateValue(); if (value == null) { throw new IncompleteAnnotationException(klazz, name);
merged.add(val.setDefinition(def)); continue nextNew;
/** * Returns a hash code composed as a sum of hash codes of member elements, * including elements with default values. * @see AnnotationMember#hashCode() */ public int hashCode() { int hash = 0; for (AnnotationMember element : elements) { hash += element.hashCode(); } return hash; }
if (name.equals(that.name) && tag == that.tag) { if (tag == ARRAY) { return equalArrayValue(that.value); } else if (tag == ERROR) {
throw new IllegalArgumentException(method.toString()); } else { Object value = element.validateValue(); if (value == null) { throw new IncompleteAnnotationException(klazz, name);
/** * Validates contained value against its member definition * and if ok returns the value. * Otherwise, if the value type mismatches definition * or the value itself describes an error, * throws appropriate exception. * <br> Note, this method may return null if this element was constructed * with such value. * * @see #rethrowError() * @see #copyValue() * @return actual valid value or null if no value */ public Object validateValue() throws Throwable { if (tag == ERROR) { rethrowError(); } if (value == NO_VALUE) { return null; } if (elementType == value.getClass() || elementType.isInstance(value)) { // nested annotation value return copyValue(); } else { throw new AnnotationTypeMismatchException(definingMethod, value.getClass().getName()); } }
if (el1.equals(el2)) { continue next; if (otherValue != null) { if (el.tag == AnnotationMember.ARRAY) { if (!el.equalArrayValue(otherValue)) { return false;
/** * New instances should not be created directly, use factory method * {@link #createAnnotation(Class, AnnotationMember[]) createAnnotation()} * instead. * * @param klzz class defining the annotation type * @param values actual element values */ private AnnotationFactory(Class<? extends Annotation> klzz, AnnotationMember[] values) { klazz = klzz; AnnotationMember[] defs = getElementsDescription(klazz); if (values == null) { elements = defs; } else { //merge default and actual values elements = new AnnotationMember[defs.length]; next: for (int i = elements.length - 1; i >= 0; i--) { for (AnnotationMember val : values) { if (val.name.equals(defs[i].name)) { elements[i] = val.setDefinition(defs[i]); continue next; } } elements[i] = defs[i]; } } }
/** * Returns a hash code composed as a sum of hash codes of member elements, * including elements with default values. * @see AnnotationMember#hashCode() */ public int hashCode() { int hash = 0; for (AnnotationMember element : elements) { hash += element.hashCode(); } return hash; }
Class<?> type = element.getReturnType(); try { desc[i] = new AnnotationMember(name, element.getDefaultValue(), type, element); } catch (Throwable t) { desc[i] = new AnnotationMember(name, t, type, element);
if (name.equals(that.name) && tag == that.tag) { if (tag == ARRAY) { return equalArrayValue(that.value); } else if (tag == ERROR) {
throw new IllegalArgumentException(method.toString()); } else { Object value = element.validateValue(); if (value == null) { throw new IncompleteAnnotationException(klazz, name);
/** * Validates contained value against its member definition * and if ok returns the value. * Otherwise, if the value type mismatches definition * or the value itself describes an error, * throws appropriate exception. * <br> Note, this method may return null if this element was constructed * with such value. * * @see #rethrowError() * @see #copyValue() * @return actual valid value or null if no value */ public Object validateValue() throws Throwable { if (tag == ERROR) { rethrowError(); } if (value == NO_VALUE) { return null; } if (elementType == value.getClass() || elementType.isInstance(value)) { // nested annotation value return copyValue(); } else { throw new AnnotationTypeMismatchException(definingMethod, value.getClass().getName()); } }
if (el1.equals(el2)) { continue next; if (otherValue != null) { if (el.tag == AnnotationMember.ARRAY) { if (!el.equalArrayValue(otherValue)) { return false;