Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * JBoss, Home of Professional Open Source
  * Copyright 2013, Red Hat, Inc., and individual contributors
  * by the @authors tag. See the copyright.txt in the distribution for a
  * full listing of individual contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jboss.weld.bootstrap;
import static org.jboss.weld.util.reflection.Reflections.cast;
Takes care of loading a class, creating org.jboss.weld.annotated.slim.backed.BackedAnnotatedType and creating org.jboss.weld.annotated.slim.SlimAnnotatedTypeContext.

Author(s):
Jozef Hartinger
public class AnnotatedTypeLoader {
    public AnnotatedTypeLoader(BeanManagerImpl managerClassTransformer transformerContainerLifecycleEvents containerLifecycleEvents) {
        this. = manager.getServices().get(ResourceLoader.class);
        this. = transformer;
        this. = containerLifecycleEvents;
    }

    
Creates a new org.jboss.weld.annotated.slim.SlimAnnotatedTypeContext instance for a class with the specified class name. This method may return null if there is a problem loading the class or this class is not needed for further processing (e.g. an annotation or a vetoed class).

Parameters:
className the specified class name
bdaId the identifier of the bean archive this class resides in
Returns:
a new SlimAnnotatedTypeContext for a specified class or null
    public <T> SlimAnnotatedTypeContext<T> loadAnnotatedType(String classNameString bdaId) {
        return createContext(loadAnnotatedType(this.<T> loadClass(className), bdaId));
    }
    protected <T> Class<T> loadClass(String className) {
        try {
            return cast(.classForName(className));
        } catch (ResourceLoadingException e) {
            .handleResourceLoadingException(classNamee);
            return null;
        }
    }
    protected <T> SlimAnnotatedType<T> loadAnnotatedType(Class<T> clazzString bdaId) {
        if (clazz != null && !clazz.isAnnotation()) {
            try {
                if (!Beans.isVetoed(clazz)) { // may throw ArrayStoreException - see bug http://bugs.sun.com/view_bug.do?bug_id=7183985
                    .preloadProcessAnnotatedType(clazz);
                    try {
                        return .getBackedAnnotatedType(clazzbdaId);
                    } catch (ResourceLoadingException e) {
                        .handleResourceLoadingException(clazz.getName(), e);
                    }
                }
            } catch (ArrayStoreException e) {
                .handleResourceLoadingException(clazz.getName(), e);
            }
        }
        return null;
    }
    protected <T> SlimAnnotatedTypeContext<T> createContext(SlimAnnotatedType<T> type) {
        if (type != null) {
            return SlimAnnotatedTypeContext.of(type);
        }
        return null;
    }
New to GrepCode? Check out our FAQ X