Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.jboss.weld.interceptor.reader;
 
 import static org.jboss.weld.util.cache.LoadingCacheUtils.getCastCacheValue;
 
 
InterceptorMetadata reader. The reader produces InterceptorMetadata instances for plain interceptors, CDI interceptors and components' target classes.

This class is thread-safe.

Author(s):
Jozef Hartinger
public class InterceptorMetadataReader {
    private final BeanManagerImpl manager;
    public InterceptorMetadataReader(final BeanManagerImpl manager) {
        this. = manager;
        final CacheBuilder<ObjectObjectcacheBuilder = CacheBuilder.newBuilder();
        this. = cacheBuilder.build(new CacheLoader<Class<?>, InterceptorClassMetadata<?>>() {
            @SuppressWarnings({ "rawtypes""unchecked" })
            @Override
            public InterceptorClassMetadata<?> load(Class<?> keythrows Exception {
                EnhancedAnnotatedType<?> type = manager.getServices().get(ClassTransformer.class).getEnhancedAnnotatedType(keymanager.getId());
                InterceptorFactory<?> factory = PlainInterceptorFactory.of(keymanager);
                return new InterceptorMetadataImpl(keyfactory, InterceptorMetadataUtils.buildMethodMap(typefalsemanager));
            }
        });
        this. = cacheBuilder.build(new CacheLoader<Interceptor<?>, InterceptorClassMetadata<?>>() {
            @Override
            public InterceptorClassMetadata<?> load(Interceptor<?> keythrows Exception {
                return CustomInterceptorMetadata.of(key);
            }
        });
            @Override
            public InterceptorClassMetadata<?> apply(Interceptor<?> input) {
                return getCdiInterceptorMetadata(input);
            }
        };
    }
    public <T> InterceptorClassMetadata<T> getPlainInterceptorMetadata(Class<T> clazz) {
        return getCastCacheValue(clazz);
    }
        return TargetClassInterceptorMetadata.of(InterceptorMetadataUtils.buildMethodMap(typetrue));
    }
    public <T> InterceptorClassMetadata<T> getCdiInterceptorMetadata(Interceptor<T> interceptor) {
        if (interceptor instanceof InterceptorImpl) {
            InterceptorImpl<T> interceptorImpl = (InterceptorImpl<T>) interceptor;
            return interceptorImpl.getInterceptorMetadata();
        }
        return getCastCacheValue(interceptor);
    }
    }
    public void cleanAfterBoot() {
    }
New to GrepCode? Check out our FAQ X