Package com.google.inject

Examples of com.google.inject.Inject.optional()


   * @param member method to be checked
   * @return true if method is injected optionally
   */
  public boolean isOptional(MemberLiteral<?, ?> member) {
    Inject annotation = member.getAnnotation(Inject.class);
    return annotation != null && annotation.optional();
  }

  /**
   * Collects and returns all keys required to member-inject the given class.
   *
 
View Full Code Here


          try
          {
            Annotation bindingAnnotation = findBindingAnnotation(field.getAnnotations());
            Object proxy = LazyInitProxyFactory.createProxy(field.getType(),
                new GuiceProxyTargetLocator(field, bindingAnnotation,
                    injectAnnotation.optional()));

            if (!field.isAccessible())
            {
              field.setAccessible(true);
            }
View Full Code Here

            try
            {
              Annotation bindingAnnotation = findBindingAnnotation(paramAnnotations[i]);
              args[i] = LazyInitProxyFactory.createProxy(paramTypes[i],
                  new GuiceProxyTargetLocator(method, i, bindingAnnotation,
                      injectAnnotation.optional()));
            }
            catch (MoreThanOneBindingException e)
            {
              throw new RuntimeException(
                  "Can't have more than one BindingAnnotation on parameter " + i +
View Full Code Here

          try
          {
            Annotation bindingAnnotation = findBindingAnnotation(field.getAnnotations());
            Object proxy = LazyInitProxyFactory.createProxy(field.getType(),
                new GuiceProxyTargetLocator(field, bindingAnnotation,
                    injectAnnotation.optional()));
            if (!field.isAccessible())
            {
              field.setAccessible(true);
            }
            field.set(object, proxy);
View Full Code Here

            try
            {
              Annotation bindingAnnotation = findBindingAnnotation(paramAnnotations[i]);
              args[i] = LazyInitProxyFactory.createProxy(paramTypes[i],
                  new GuiceProxyTargetLocator(method, i, bindingAnnotation,
                      injectAnnotation.optional()));
            }
            catch (MoreThanOneBindingException e)
            {
              throw new RuntimeException(
                  "Can't have more than one BindingAnnotation on parameter " + i +
View Full Code Here

      {
        try
        {
          Annotation bindingAnnotation = findBindingAnnotation(field.getAnnotations());
          final IProxyTargetLocator locator = new GuiceProxyTargetLocator(field,
              bindingAnnotation, injectAnnotation.optional());

          if (wrapInProxies)
          {
            target = LazyInitProxyFactory.createProxy(field.getType(), locator);
          }
View Full Code Here

          try
          {
            Annotation bindingAnnotation = findBindingAnnotation(field.getAnnotations());
            Object proxy = LazyInitProxyFactory.createProxy(field.getType(),
                new GuiceProxyTargetLocator(field, bindingAnnotation,
                    injectAnnotation.optional()));
            if (!field.isAccessible())
            {
              field.setAccessible(true);
            }
            field.set(object, proxy);
View Full Code Here

            try
            {
              Annotation bindingAnnotation = findBindingAnnotation(paramAnnotations[i]);
              args[i] = LazyInitProxyFactory.createProxy(paramTypes[i],
                  new GuiceProxyTargetLocator(method, i, bindingAnnotation,
                      injectAnnotation.optional()));
            }
            catch (MoreThanOneBindingException e)
            {
              throw new RuntimeException(
                  "Can't have more than one BindingAnnotation on parameter " + i +
View Full Code Here

          try
          {
            Annotation bindingAnnotation = findBindingAnnotation(field.getAnnotations());
            Object proxy = LazyInitProxyFactory.createProxy(field.getType(),
                new GuiceProxyTargetLocator(field, bindingAnnotation,
                    injectAnnotation.optional()));

            if (!field.isAccessible())
            {
              field.setAccessible(true);
            }
View Full Code Here

            try
            {
              Annotation bindingAnnotation = findBindingAnnotation(paramAnnotations[i]);
              args[i] = LazyInitProxyFactory.createProxy(paramTypes[i],
                  new GuiceProxyTargetLocator(method, i, bindingAnnotation,
                      injectAnnotation.optional()));
            }
            catch (MoreThanOneBindingException e)
            {
              throw new RuntimeException(
                  "Can't have more than one BindingAnnotation on parameter " + i +
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.