/** * Returns the hash code of the represented annotation. * * @return The hash code of the represented annotation. */ private int hashCodeRepresentation() { int hashCode = 0; for (Map.Entry<Method, AnnotationValue.Loaded<?>> entry : values.entrySet()) { if (!entry.getValue().getState().isDefined()) { continue; } hashCode += (127 * entry.getKey().getName().hashCode()) ^ entry.getValue().hashCode(); } return hashCode; }
/** * Returns the string representation of the represented annotation. * * @return The string representation of the represented annotation. */ protected String toStringRepresentation() { StringBuilder toString = new StringBuilder(); toString.append('@'); toString.append(annotationType.getName()); toString.append('('); boolean firstMember = true; for (Map.Entry<Method, AnnotationValue.Loaded<?>> entry : values.entrySet()) { if (!entry.getValue().getState().isDefined()) { continue; } if (firstMember) { firstMember = false; } else { toString.append(", "); } toString.append(entry.getKey().getName()) .append('=') .append(entry.getValue().toString()); } toString.append(')'); return toString.toString(); }
/** * {@inheritDoc} */ public boolean represents(Object value) { if (!(value instanceof Object[])) return false; if (value.getClass().getComponentType() != componentType) return false; Object[] array = (Object[]) value; if (values.size() != array.length) return false; Iterator<AnnotationValue.Loaded<?>> iterator = values.iterator(); for (Object aValue : array) { AnnotationValue.Loaded<?> self = iterator.next(); if (!self.getState().isResolved() || !self.represents(aValue)) { return false; } } return true; }
@Override public boolean equals(Object other) { if (this == other) { return true; } else if (!(other instanceof AnnotationValue.Loaded<?>)) { return false; } AnnotationValue.Loaded<?> annotationValue = (AnnotationValue.Loaded<?>) other; if (!annotationValue.getState().isResolved()) { return false; } Object value = annotationValue.resolve(); if (!(value instanceof Object[])) { return false; } Object[] arrayValue = (Object[]) value; if (values.size() != arrayValue.length) { return false; } Iterator<AnnotationValue.Loaded<?>> iterator = values.iterator(); for (Object aValue : arrayValue) { AnnotationValue.Loaded<?> self = iterator.next(); if (!self.getState().isResolved() || !self.resolve().equals(aValue)) { return false; } } return true; }
@Override public boolean equals(Object other) { if (this == other) { return true; } else if (!(other instanceof AnnotationValue.Loaded<?>)) { return false; } AnnotationValue.Loaded<?> annotationValue = (AnnotationValue.Loaded<?>) other; if (!annotationValue.getState().isResolved()) { return false; } Object value = annotationValue.resolve(); if (!(value instanceof Object[])) { return false; } Object[] arrayValue = (Object[]) value; if (values.size() != arrayValue.length) { return false; } Iterator<AnnotationValue.Loaded<?>> iterator = values.iterator(); for (Object aValue : arrayValue) { AnnotationValue.Loaded<?> self = iterator.next(); if (!self.resolve().equals(aValue)) { return false; } } return true; }
@Override public boolean equals(Object other) { if (this == other) { return true; } else if (!(other instanceof AnnotationValue.Loaded<?>)) { return false; } AnnotationValue.Loaded<?> annotationValue = (AnnotationValue.Loaded<?>) other; return annotationValue.getState().isResolved() && type.equals(annotationValue.resolve()); }
@Override public boolean equals(Object other) { if (this == other) { return true; } else if (!(other instanceof AnnotationValue.Loaded<?>)) { return false; } AnnotationValue.Loaded<?> annotationValue = (AnnotationValue.Loaded<?>) other; return annotationValue.getState().isResolved() && annotation.equals(annotationValue.resolve()); }
@Override public boolean equals(Object other) { if (this == other) { return true; } else if (!(other instanceof AnnotationValue.Loaded<?>)) { return false; } AnnotationValue.Loaded<?> annotationValue = (AnnotationValue.Loaded<?>) other; return annotationValue.getState().isResolved() && type.equals(annotationValue.resolve()); }
/** * {@inheritDoc} */ public State getState() { for (AnnotationValue.Loaded<?> value : values) { if (!value.getState().isResolved()) { return State.UNRESOLVED; } } return State.RESOLVED; }
@Override public boolean equals(Object other) { if (this == other) { return true; } else if (!(other instanceof AnnotationValue.Loaded<?>)) { return false; } AnnotationValue.Loaded<?> annotationValue = (AnnotationValue.Loaded<?>) other; return annotationValue.getState().isResolved() && enumeration.equals(annotationValue.resolve()); }
@Override public boolean equals(Object other) { if (this == other) { return true; } else if (!(other instanceof AnnotationValue.Loaded<?>)) { return false; } AnnotationValue.Loaded<?> annotationValue = (AnnotationValue.Loaded<?>) other; return annotationValue.getState().isResolved() && propertyDelegate.equals(value, annotationValue.resolve()); }
/** * {@inheritDoc} */ public State getState() { for (AnnotationValue.Loaded<?> value : values) { if (!value.getState().isResolved()) { return State.UNRESOLVED; } } return State.RESOLVED; }