@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof AnnotationType) { AnnotationType that = (AnnotationType) obj; return this.name.equals(that.name); } return false; }
return true; if (OBJECT_NAME.equals(name)) { return false; // there's nothing assignable from Object.class except for Object.class
private boolean containsAnnotation(ClassInfo classInfo, DotName requiredAnnotationName, Class<? extends Annotation> requiredAnnotation) { // Type and members if (classInfo.annotations().containsKey(requiredAnnotationName)) { return true; } // Meta-annotations for (DotName annotation : classInfo.annotations().keySet()) { if (annotationClassAnnotationsCache.getValue(annotation).contains(requiredAnnotationName.toString())) { return true; } } // Superclass final DotName superName = classInfo.superName(); if (superName != null && !OBJECT_NAME.equals(superName)) { final ClassInfo superClassInfo = index.getClassByName(superName); if (superClassInfo == null) { // we are accessing a class that is outside of the jandex index // fallback to using reflection return Reflections.containsAnnotation(loadClass(superName.toString()), requiredAnnotation); } if (containsAnnotation(superClassInfo, requiredAnnotationName, requiredAnnotation)) { return true; } } return false; }
/** * Returns whether or not this annotation instance is equivalent to another instance. * An annotation instance is equivalent if its name and values are equal, and it shares * the exact same <code>AnnotationTarget</code> instance. The latter restriction * may be softened in future versions. * * @param o the annotation instance to compare to. * @return true if equal, false if not * * @see Object#equals(Object) */ @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; AnnotationInstance instance = (AnnotationInstance) o; return target == instance.target && name.equals(instance.name) && Arrays.equals(values, instance.values); }
/** * Compares this Type with another type, and returns true if they are equivalent. * A type is equivalent to another type if it is the same kind, and all of its * fields are equal. This includes annotations, which must be equal as well. * * @param o the type to compare to * @return true if equal * @see Object#equals(Object) */ @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Type type = (Type) o; return name.equals(type.name) && Arrays.equals(annotations, type.annotations); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } EnumValue enumValue = (EnumValue) o; return super.equals(o) && typeName.equals(enumValue.typeName) && value.equals(enumValue.value); }
public static boolean isJaxwsService(final ClassInfo current, final CompositeIndex index) { ClassInfo tmp = current; while (tmp != null) { final DotName superName = tmp.superName(); if (JAXWS_SERVICE_CLASS.equals(superName)) { return true; } tmp = index.getClassByName(superName); } return false; }
public static boolean isJaxwsService(final ClassInfo current, final CompositeIndex index) { ClassInfo tmp = current; while (tmp != null) { final DotName superName = tmp.superName(); if (JAXWS_SERVICE_CLASS.equals(superName)) { return true; } tmp = index.getClassByName(superName); } return false; }
public static boolean isJaxwsService(final ClassInfo current, final Index index) { ClassInfo tmp = current; while (tmp != null) { final DotName superName = tmp.superName(); if (JAXWS_SERVICE_CLASS.equals(superName)) { return true; } tmp = index.getClassByName(superName); } return false; }
public static boolean isJaxwsService(final ClassInfo current, final Index index) { ClassInfo tmp = current; while (tmp != null) { final DotName superName = tmp.superName(); if (JAXWS_SERVICE_CLASS.equals(superName)) { return true; } tmp = index.getClassByName(superName); } return false; }
public static boolean isJaxwsService(final ClassInfo current, final Index index) { ClassInfo tmp = current; while (tmp != null) { final DotName superName = tmp.superName(); if (JAXWS_SERVICE_CLASS.equals(superName)) { return true; } tmp = index.getClassByName(superName); } return false; }
public static boolean isJaxwsService(final ClassInfo current, final CompositeIndex index) { ClassInfo tmp = current; while (tmp != null) { final DotName superName = tmp.superName(); if (JAXWS_SERVICE_CLASS.equals(superName)) { return true; } tmp = index.getClassByName(superName); } return false; }
private void processInnerClasses(DataInputStream data, ClassInfo target) throws IOException { int numClasses = data.readUnsignedShort(); innerClasses = numClasses > 0 ? new HashMap<DotName, InnerClassInfo>(numClasses) : Collections.<DotName, InnerClassInfo>emptyMap(); for (int i = 0; i < numClasses; i++) { DotName innerClass = decodeClassEntry(data.readUnsignedShort()); int outerIndex = data.readUnsignedShort(); DotName outerClass = outerIndex == 0 ? null : decodeClassEntry(outerIndex); int simpleIndex = data.readUnsignedShort(); String simpleName = simpleIndex == 0 ? null : decodeUtf8Entry(simpleIndex); int flags = data.readUnsignedShort(); if (innerClass.equals(target.name())) { target.setInnerClassInfo(outerClass, simpleName); target.setFlags((short)flags); } innerClasses.put(innerClass, new InnerClassInfo(innerClass, outerClass, simpleName, flags)); } }
public ColumnValues(AnnotationInstance columnAnnotation) { if ( columnAnnotation != null && !JPADotNames.COLUMN.equals( columnAnnotation.name() ) ) { throw new AssertionFailure( "A @Column annotation needs to be passed to the constructor" ); } applyColumnValues( columnAnnotation ); }
private static void addMappedSuperclasses(Index index, ClassInfo info, List<ClassInfo> classInfoList) { DotName superName = info.superName(); ClassInfo tmpInfo; // walk up the hierarchy until java.lang.Object while ( !OBJECT.equals( superName ) ) { tmpInfo = index.getClassByName( superName ); if ( isMappedSuperclass( tmpInfo ) ) { classInfoList.add( tmpInfo ); } superName = tmpInfo.superName(); } }
private static void addMappedSuperclasses(Index index, ClassInfo info, List<ClassInfo> classInfoList) { DotName superName = info.superName(); ClassInfo tmpInfo; // walk up the hierarchy until java.lang.Object while ( !OBJECT.equals( superName ) ) { tmpInfo = index.getClassByName( superName ); if ( isMappedSuperclass( tmpInfo ) ) { classInfoList.add( tmpInfo ); } superName = tmpInfo.superName(); } }
public ColumnValues(AnnotationInstance columnAnnotation) { if ( columnAnnotation != null && !JPADotNames.COLUMN.equals( columnAnnotation.name() ) ) { throw new AssertionFailure( "A @Column annotation needs to be passed to the constructor" ); } applyColumnValues( columnAnnotation ); }
public AttributeOverride(String prefix, AnnotationInstance attributeOverrideAnnotation) { if ( attributeOverrideAnnotation == null ) { throw new IllegalArgumentException( "An AnnotationInstance needs to be passed" ); } if ( !JPADotNames.ATTRIBUTE_OVERRIDE.equals( attributeOverrideAnnotation.name() ) ) { throw new AssertionFailure( "A @AttributeOverride annotation needs to be passed to the constructor" ); } columnValues = new ColumnValues( JandexHelper.getValue( attributeOverrideAnnotation, "column", AnnotationInstance.class ) ); attributePath = createAttributePath( prefix, JandexHelper.getValue( attributeOverrideAnnotation, "name", String.class ) ); }
protected AccessType getAccessFromIndex(DotName className) { Map<DotName, List<AnnotationInstance>> indexedAnnotations = indexBuilder.getIndexedAnnotations( className ); List<AnnotationInstance> accessAnnotationInstances = indexedAnnotations.get( ACCESS ); if ( MockHelper.isNotEmpty( accessAnnotationInstances ) ) { for ( AnnotationInstance annotationInstance : accessAnnotationInstances ) { if ( annotationInstance.target() != null && annotationInstance.target() instanceof ClassInfo ) { ClassInfo ci = (ClassInfo) ( annotationInstance.target() ); if ( className.equals( ci.name() ) ) { //todo does ci need to have @Entity or @MappedSuperClass ?? return AccessType.valueOf( annotationInstance.value().asEnum() ); } } } } return null; }
protected AccessType getAccessFromIndex(DotName className) { Map<DotName, List<AnnotationInstance>> indexedAnnotations = indexBuilder.getIndexedAnnotations( className ); List<AnnotationInstance> accessAnnotationInstances = indexedAnnotations.get( ACCESS ); if ( MockHelper.isNotEmpty( accessAnnotationInstances ) ) { for ( AnnotationInstance annotationInstance : accessAnnotationInstances ) { if ( annotationInstance.target() != null && annotationInstance.target() instanceof ClassInfo ) { ClassInfo ci = (ClassInfo) ( annotationInstance.target() ); if ( className.equals( ci.name() ) ) { //todo does ci need to have @Entity or @MappedSuperClass ?? return AccessType.valueOf( annotationInstance.value().asEnum() ); } } } } return null; }