Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source
   * Copyright 2008, Red Hat, Inc. and/or its affiliates, 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.proxy;
 
 
 
A simple BeanInstance which always maintains a specific bean instance that is being proxied.

Author(s):
David Allen
 
 public class TargetBeanInstance extends AbstractBeanInstance implements Serializable {
     private static final long serialVersionUID = 1099995238604086450L;
     private final Object instance;
     private final Class<?> instanceType;
 
     public TargetBeanInstance(Bean<?> beanObject instance) {
         this. = instance;
         this. = computeInstanceType(bean);
     }
 
     public TargetBeanInstance(Object instance) {
         this. = instance;
         this. = instance.getClass();
     }

    
Copy constructor

Parameters:
otherBeanInstance other bean instance to copy
 
     public TargetBeanInstance(TargetBeanInstance otherBeanInstance) {
         this. = otherBeanInstance.instance;
         this. = otherBeanInstance.instanceType;
         this. = otherBeanInstance.interceptorsHandler;
     }
 
     public Object getInstance() {
         return ;
     }
 
     public Class<?> getInstanceType() {
         return ;
     }

    

Returns:
the interceptorsHandler
 
     public MethodHandler getInterceptorsHandler() {
         return ;
     }

    

Parameters:
interceptorsHandler the interceptorsHandler to set
 
     public void setInterceptorsHandler(MethodHandler interceptorsHandler) {
         this. = interceptorsHandler;
     }
 
     @Override
     public Object invoke(Object instanceMethod methodObject... argumentsthrows Throwable {
         if ( != null) {
             if (..isTraceEnabled()) {
                 // Level checking is not a very nice performance optimization - however we don't want to invoke toGenericString() unless really necessary
                 ..invokingInterceptorChain(method.toGenericString(), instance);
             }
             if (method.getDeclaringClass().isInterface()) {
                 return .invoke(instancemethodnullarguments);
             } else {
                 return .invoke(instancemethodmethodarguments);
             }
         } else {
             if (..isTraceEnabled()) {
                 ..invokingMethodDirectly(method.toGenericString(), instance);
             }
             return super.invoke(instancemethodarguments);
         }
     }
New to GrepCode? Check out our FAQ X