Package java.lang.reflect

Examples of java.lang.reflect.AnnotatedElement


    /**
     * getAnnotations() should return cloned array
     * which can be safely modified by a caller.
     */
    public void testGetAnnotationsImmutable() throws Throwable {
        AnnotatedElement el = getElement1();
        Annotation[] an = el.getAnnotations();
        assertNotNull(an);
        assertEquals("number of Annotations", 1, an.length);
        assertSame(TagAntn.class, an[0].annotationType());
        an[0] = null;
        Annotation[] an2 = el.getAnnotations();
        assertNotNull(an2);
        assertEquals("number of second Annotations", 1, an2.length);
        assertNotNull("array is not immutable", an2[0]);
        assertSame(TagAntn.class, an2[0].annotationType());
    }
View Full Code Here


                int id=0;

                for (final IndexItem<?,Object> item : index) {
                    id++;
                    try {
                        AnnotatedElement e = item.element();
                        Annotation a = item.annotation();
                        if (!isActive(a,e))   continue;

                        if (e instanceof Class) {
                            Key key = Key.get((Class)e);
View Full Code Here

        private <T> Collection<ExtensionComponent<T>> _find(Class<T> type, List<IndexItem<Extension,Object>> indices) {
            List<ExtensionComponent<T>> result = new ArrayList<ExtensionComponent<T>>();

            for (IndexItem<Extension,Object> item : indices) {
                try {
                    AnnotatedElement e = item.element();
                    Class<?> extType;
                    if (e instanceof Class) {
                        extType = (Class) e;
                    } else
                    if (e instanceof Field) {
View Full Code Here

                try {
                    // we might end up having multiple threads concurrently calling into element(),
                    // but we can't synchronize this --- if we do, the one thread that's supposed to load a class
                    // can block while other threads wait for the entry into the element call().
                    // looking at the sezpoz code, it should be safe to do so
                    AnnotatedElement e = item.element();
                    Class<?> extType;
                    if (e instanceof Class) {
                        extType = (Class) e;
                    } else
                    if (e instanceof Field) {
View Full Code Here

            if( injectionClass.equals( Method.class ) )
            {
                return methodModel.method();
            }

            final AnnotatedElement annotatedElement = methodModel.annotatedElement();
            if( injectionClass.equals( AnnotatedElement.class ) )
            {
                return annotatedElement;
            }
            final Annotation annotation = annotatedElement.getAnnotation( injectionClass );
            if( annotation != null )
            {
                return annotation;
            }
            if( dependencyModel.injectionType() instanceof Class<?> )
            {
                return annotatedElement.getAnnotation( (Class<Annotation>) dependencyModel.injectionType() );
            }
            return null;
        }
View Full Code Here

         {
            getJaxrpcBinder().setupServiceRef(encCtx, encName, null, serviceRef, loader);
         }
         else
         {
            AnnotatedElement anElement = (AnnotatedElement)sref.getAnnotatedElement();
            getJaxwsBinder().setupServiceRef(encCtx, encName, anElement, serviceRef, loader);
         }
      }
      finally
      {
View Full Code Here

            //
            // If the initialization map derives its values from a Java annotated element,
            // then allow container overrides on this element to be applied.  This will also
            // coelesce maps referencing the same element.
            //
            AnnotatedElement annotElem = null;
            if (initProperties instanceof AnnotatedElementMap)
            {
                annotElem = ((AnnotatedElementMap)initProperties).getAnnotatedElement();
                initProperties = getAnnotationMap(annotElem);
            }
View Full Code Here

     * @param clazz annotation class
     * @return true or false
     */
    public static boolean hasMethodAnnotation(Method method, Class<? extends Annotation> clazz)
    {
        final AnnotatedElement element = method;
        Annotation[] anns = getDeclaredAnnotations(element);
        for (Annotation annotation : anns)
        {
            if (annotation.annotationType().equals(clazz))
            {
View Full Code Here

                    "But the decorator bean : " + toString() + " has none");
        }
       
        if(!(ipFound.getMember() instanceof Constructor))
        {
            AnnotatedElement element = (AnnotatedElement)ipFound.getMember();
            if(!element.isAnnotationPresent(Inject.class))
            {
                String message = "Error in decorator : "+ toString() + ". The delegate injection point must be an injected field, " +
                        "initializer method parameter or bean constructor method parameter.";

                throw new WebBeansConfigurationException(message);
View Full Code Here

    view.getEdmSimpleProperty().setName(propertyName);

    JPAEdmMapping mapping = new JPAEdmMappingImpl();
    mapping.setJPAType(jpaAttribute.getJavaType());

    AnnotatedElement annotatedElement = (AnnotatedElement) jpaAttribute.getJavaMember();
    if (annotatedElement != null) {
      Column column = annotatedElement.getAnnotation(Column.class);
      if (column != null) {
        mapping.setJPAColumnName(column.name());
      } else {
        if (joinColumnNames != null) {
          mapping.setJPAColumnName(joinColumnNames[0]);
View Full Code Here

TOP

Related Classes of java.lang.reflect.AnnotatedElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.