Java Code Examples for net.bytebuddy.description.annotation.AnnotationList#ForLoadedAnnotations
The following examples show how to use
net.bytebuddy.description.annotation.AnnotationList#ForLoadedAnnotations .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ParameterDescription.java From byte-buddy with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST", justification = "The implicit field type casting is not understood by Findbugs") public AnnotationList getDeclaredAnnotations() { Annotation[][] annotation = parameterAnnotationSource.getParameterAnnotations(); MethodDescription.InDefinedShape declaringMethod = getDeclaringMethod(); if (annotation.length != declaringMethod.getParameters().size() && declaringMethod.getDeclaringType().isInnerClass()) { return index == 0 ? new AnnotationList.Empty() : new AnnotationList.ForLoadedAnnotations(annotation[index - 1]); } else { return new AnnotationList.ForLoadedAnnotations(annotation[index]); } }
Example 2
Source File: ParameterDescription.java From byte-buddy with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ public AnnotationList getDeclaredAnnotations() { MethodDescription.InDefinedShape declaringMethod = getDeclaringMethod(); Annotation[][] parameterAnnotation = parameterAnnotationSource.getParameterAnnotations(); if (parameterAnnotation.length != declaringMethod.getParameters().size() && declaringMethod.getDeclaringType().isInnerClass()) { return index == 0 ? new AnnotationList.Empty() : new AnnotationList.ForLoadedAnnotations(parameterAnnotation[index - 1]); } else { return new AnnotationList.ForLoadedAnnotations(parameterAnnotation[index]); } }
Example 3
Source File: FieldDescriptionLatentTest.java From byte-buddy with Apache License 2.0 | 5 votes |
protected FieldDescription.InDefinedShape describe(Field field) { return new FieldDescription.Latent(TypeDescription.ForLoadedType.of(field.getDeclaringClass()), field.getName(), field.getModifiers(), TypeDefinition.Sort.describe(field.getGenericType()), new AnnotationList.ForLoadedAnnotations(field.getDeclaredAnnotations())); }
Example 4
Source File: JavaModule.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public AnnotationList getDeclaredAnnotations() { return new AnnotationList.ForLoadedAnnotations(module.getDeclaredAnnotations()); }
Example 5
Source File: FieldDescription.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @CachedReturnPlugin.Enhance("declaredAnnotations") public AnnotationList getDeclaredAnnotations() { return new AnnotationList.ForLoadedAnnotations(field.getDeclaredAnnotations()); }
Example 6
Source File: MethodDescription.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @CachedReturnPlugin.Enhance("declaredAnnotations") public AnnotationList getDeclaredAnnotations() { return new AnnotationList.ForLoadedAnnotations(constructor.getDeclaredAnnotations()); }
Example 7
Source File: MethodDescription.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @CachedReturnPlugin.Enhance("declaredAnnotations") public AnnotationList getDeclaredAnnotations() { return new AnnotationList.ForLoadedAnnotations(method.getDeclaredAnnotations()); }
Example 8
Source File: ParameterDescription.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST", justification = "The implicit field type casting is not understood by Findbugs") public AnnotationList getDeclaredAnnotations() { return new AnnotationList.ForLoadedAnnotations(parameterAnnotationSource.getParameterAnnotations()[index]); }
Example 9
Source File: ParameterDescription.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public AnnotationList getDeclaredAnnotations() { return new AnnotationList.ForLoadedAnnotations(parameterAnnotationSource.getParameterAnnotations()[index]); }
Example 10
Source File: PackageDescription.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public AnnotationList getDeclaredAnnotations() { return new AnnotationList.ForLoadedAnnotations(aPackage.getDeclaredAnnotations()); }
Example 11
Source File: RecordComponentDescription.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public AnnotationList getDeclaredAnnotations() { return new AnnotationList.ForLoadedAnnotations(recordComponent.getDeclaredAnnotations()); }
Example 12
Source File: MethodAttributeAppenderExplicitTest.java From byte-buddy with Apache License 2.0 | 4 votes |
@Test public void testFactory() throws Exception { MethodAttributeAppender.Explicit methodAttributeAppender = new MethodAttributeAppender.Explicit(new AnnotationList.ForLoadedAnnotations(new Qux.Instance())); assertThat(methodAttributeAppender.make(instrumentedType), sameInstance((MethodAttributeAppender) methodAttributeAppender)); verifyZeroInteractions(instrumentedType); }
Example 13
Source File: RecordComponentAttributeAppenderForAnnotationsTest.java From byte-buddy with Apache License 2.0 | 4 votes |
@Test public void testFactory() throws Exception { RecordComponentAttributeAppender.Explicit recordComponentAttributeAppender = new RecordComponentAttributeAppender.Explicit(new AnnotationList.ForLoadedAnnotations(new QuxBaz.Instance())); assertThat(recordComponentAttributeAppender.make(instrumentedType), sameInstance((RecordComponentAttributeAppender) recordComponentAttributeAppender)); }
Example 14
Source File: FieldAttributeAppenderForAnnotationsTest.java From byte-buddy with Apache License 2.0 | 4 votes |
@Test public void testFactory() throws Exception { FieldAttributeAppender.Explicit fieldAttributeAppender = new FieldAttributeAppender.Explicit(new AnnotationList.ForLoadedAnnotations(new QuxBaz.Instance())); assertThat(fieldAttributeAppender.make(instrumentedType), sameInstance((FieldAttributeAppender) fieldAttributeAppender)); }