Package javax.enterprise.inject

Examples of javax.enterprise.inject.UnproxyableResolutionException


            {
               Method m = methods[i];
               int modifiers = m.getModifiers();
               if (Modifier.isFinal(modifiers) && !Modifier.isPrivate(modifiers) && !Modifier.isStatic(modifiers))
               {
                  throw new UnproxyableResolutionException(
                     "Cannot create a proxy for the class "
                        + superClass.getName()
                        + " because it has at least one non-static, final method with public, protected or default visibility");
               }
            }
            try
            {
               ProxyFactory factory = new ProxyFactory();
               factory.setSuperclass(superClass);
               factory.setFilter(MethodFilterHolder.METHOD_FILTER);
               MethodHandler handler = new MethodHandler()
               {
                  public Object invoke(Object self, Method m, Method proceed, Object[] args) throws Throwable
                  {
                     if ((!Modifier.isPublic(m.getModifiers()) || !Modifier.isPublic(m.getDeclaringClass()
                        .getModifiers())) && !m.isAccessible())
                        m.setAccessible(true);
                     return m.invoke(provider.get(), args);
                  }
               };
               return superClass.cast(factory.create(new Class<?>[0], new Object[0], handler));
            }
            catch (Exception e)
            {
               throw new UnproxyableResolutionException("Cannot create a proxy for the class " + superClass.getName(),
                  e);
            }
         }
      };
      try
      {
         return SecurityHelper.doPrivilegedExceptionAction(action);
      }
      catch (PrivilegedActionException e)
      {
         Throwable cause = e.getCause();
         if (cause instanceof UnproxyableResolutionException)
         {
            throw (UnproxyableResolutionException)cause;
         }
         else
         {
            throw new UnproxyableResolutionException("Cannot create a proxy for the class " + superClass.getName(),
               cause);
         }
      }
   }
View Full Code Here


        // utility class ct
    }

    public static void throwUnproxyableResolutionException(ViolationMessageBuilder violationMessage)
    {
        throw new UnproxyableResolutionException(
                newViolation("WebBeans with api type with normal scope must be proxiable to inject.")
                        .addLine(violationMessage.toString())
                        .toString());
    }
View Full Code Here

        // finally, we create a new contextual instance
        webbeansInstance = webbeansContext.get((Contextual<Object>) bean, getContextualCreationalContext());

        if (webbeansInstance == null)
        {
            throw new UnproxyableResolutionException("Cannot find a contextual instance of bean " + bean.toString());
        }
        return webbeansInstance;
    }
View Full Code Here

            {
               Method m = methods[i];
               int modifiers = m.getModifiers();
               if (Modifier.isFinal(modifiers) && !Modifier.isPrivate(modifiers) && !Modifier.isStatic(modifiers))
               {
                  throw new UnproxyableResolutionException(
                     "Cannot create a proxy for the class "
                        + superClass.getName()
                        + " because it has at least one non-static, final method with public, protected or default visibility");
               }
            }
            try
            {
               ProxyFactory factory = new ProxyFactory();
               factory.setSuperclass(superClass);
               factory.setFilter(MethodFilterHolder.METHOD_FILTER);
               MethodHandler handler = new MethodHandler()
               {
                  public Object invoke(Object self, Method m, Method proceed, Object[] args) throws Throwable
                  {
                     if ((!Modifier.isPublic(m.getModifiers()) || !Modifier.isPublic(m.getDeclaringClass()
                        .getModifiers())) && !m.isAccessible())
                        m.setAccessible(true);
                     return m.invoke(provider.get(), args);
                  }
               };
               return superClass.cast(factory.create(new Class<?>[0], new Object[0], handler));
            }
            catch (Exception e)
            {
               throw new UnproxyableResolutionException("Cannot create a proxy for the class " + superClass.getName(),
                  e);
            }
         }
      };
      try
      {
         return SecurityHelper.doPrivilegedExceptionAction(action);
      }
      catch (PrivilegedActionException e)
      {
         Throwable cause = e.getCause();
         if (cause instanceof UnproxyableResolutionException)
         {
            throw (UnproxyableResolutionException)cause;
         }
         else
         {
            throw new UnproxyableResolutionException("Cannot create a proxy for the class " + superClass.getName(),
               cause);
         }
      }
   }
View Full Code Here

        // finally, we create a new contextual instance
        webbeansInstance = webbeansContext.get((Contextual<Object>)this.bean, getContextualCreationalContext());

        if (webbeansInstance == null)
        {
            throw new UnproxyableResolutionException("Cannot find a contextual instance of bean " + bean.toString());
        }
        return webbeansInstance;
    }
View Full Code Here

        // finally, we create a new contextual instance
        webbeansInstance = webbeansContext.get((Contextual<Object>)this.bean, getContextualCreationalContext());

        if (webbeansInstance == null)
        {
            throw new UnproxyableResolutionException("Cannot find a contextual instance of bean " + bean.toString());
        }
        return webbeansInstance;
    }
View Full Code Here

                    }

                    //Throw Exception
                    if(throwException)
                    {
                        throw new UnproxyableResolutionException("WebBeans with api type with normal scope " +
                                "must be proxiable to inject, but class : " + beanClass.getName()
                                + " is not proxiable type");
                    }
                }
            }
View Full Code Here

            if (ClassUtil.isPrimitive(superClass) || ClassUtil.isArray(superClass) || ClassUtil.isFinal(superClass.getModifiers()) || ClassUtil.hasFinalMethod(superClass) || (cons == null || ClassUtil.isPrivate(cons.getModifiers())))
            {
                if (scopeType.isAnnotationPresent(NormalScope.class))
                {
                    throw new UnproxyableResolutionException("WebBeans with api type with normal scope must be proxiable to inject, but class : " + superClass.getName() + " is not proxiable type");
                }
            }

        }
View Full Code Here

        CreationalContext cc = beanManager.createCreationalContext(bean);
        webbeansInstance = webbeansContext.get(bean, cc);

        if (webbeansInstance == null)
        {
            throw new UnproxyableResolutionException("Cannot find a contextual instance of bean " + bean.toString());
        }
        return webbeansInstance;
    }
View Full Code Here

        // utility class ct
    }

    public static void throwUnproxyableResolutionException(ViolationMessageBuilder violationMessage)
    {
        throw new UnproxyableResolutionException(
                newViolation("WebBeans with api type with normal scope must be proxiable to inject.")
                        .addLine(violationMessage.toString())
                        .toString());
    }
View Full Code Here

TOP

Related Classes of javax.enterprise.inject.UnproxyableResolutionException

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.