Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source
   * Copyright 2008, 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.bean;
 
 
 import java.util.Set;
 
 import static org.jboss.weld.logging.messages.BeanMessage.CONFLICTING_INTERCEPTOR_BINDINGS;
 import static org.jboss.weld.logging.messages.BeanMessage.MISSING_BINDING_ON_INTERCEPTOR;

Author(s):
Marius Bogoevici
 
 public class InterceptorImpl<T> extends ManagedBean<T> implements Interceptor<T> {
 
     private final InterceptorMetadata<?> interceptorMetadata;
 
     private final Set<AnnotationinterceptorBindingTypes;
 
     private final boolean serializable;
 
     public static <T> InterceptorImpl<T> of(WeldClass<T> typeBeanManagerImpl beanManagerServiceRegistry services) {
         return new InterceptorImpl<T>(typebeanManagerservices);
     }
 
     protected InterceptorImpl(WeldClass<T> typeBeanManagerImpl beanManagerServiceRegistry services) {
         super(typenew StringBuilder().append(Interceptor.class.getSimpleName()).append().append(type.getName()).toString(), beanManagerservices);
         this. = beanManager.getInterceptorMetadataReader().getInterceptorMetadata(ClassMetadataInterceptorReference.of(WeldInterceptorClassMetadata.of(type)));
         this. = type.isSerializable();
         this. = new HashSet<Annotation>();
         for (Class<? extends Annotationannotation : getStereotypes()) {
             .addAll(flattenInterceptorBindings(beanManagerbeanManager.getStereotypeDefinition(annotation)));
         }
         if (this..size() == 0) {
             throw new DeploymentException(type.getName());
         }
         if (Beans.findInterceptorBindingConflicts(beanManager)) {
             throw new DeploymentException(getType());
         }
     }
 
     public Set<AnnotationgetInterceptorBindings() {
         return ;
     }
 
         return ;
     }
 
     public Object intercept(InterceptionType type, T instanceInvocationContext ctx) {
         try {
             org.jboss.interceptor.spi.model.InterceptionType interceptionType = org.jboss.interceptor.spi.model.InterceptionType.valueOf(type.name());
             Collection<InterceptorInvocation<?>> invocations = new ArrayList<InterceptorInvocation<?>>();
             invocations.add(new InterceptorInvocation<T>(instanceinterceptionType));
             return new SimpleInterceptionChain(invocationsinterceptionTypeinstancectx.getMethod()).invokeNextInterceptor(ctx);
         } catch (Throwable e) {
             throw new WeldException(e);
         }
     }
 
     public boolean intercepts(InterceptionType type) {
         return .getInterceptorMethods(org.jboss.interceptor.spi.model.InterceptionType.valueOf(type.name())).size() > 0;
     }
 
    public boolean isSerializable() {
        return ;
    }
    @Override
    protected void defaultPostConstruct(T instance) {
        // Lifecycle callbacks not supported
    }
    @Override
    protected void defaultPreDestroy(T instance) {
        // Lifecycle callbacks not supported
    }
    @Override
    public String toString() {
        return "Interceptor [" + getBeanClass() + " intercepts " + Formats.formatAnnotations(getInterceptorBindings()) + "]";
    }
New to GrepCode? Check out our FAQ X