Package javax.inject

Examples of javax.inject.Inject


        return result;
    }

    private <T extends AnnotatedElement> void addAnnotated(T[] elements, Set<T> set) {
        for (T element : elements) {
            Inject injection = getAnnotation(element, Inject.class);
            if (injection != null) {
                set.add(element);
            } else {
                InjectAnnotation modelInject = getAnnotation(element, InjectAnnotation.class);
                if (modelInject != null) {
View Full Code Here


    private void autowireViaFields(final Object object, final Class<?> cls) {
        final List<Field> fields = Arrays.asList(cls.getDeclaredFields());
        final Iterable<Field> injectFields = Iterables.filter(fields, new Predicate<Field>() {
            @Override
            public boolean apply(Field input) {
                final Inject annotation = input.getAnnotation(javax.inject.Inject.class);
                return annotation != null;
            }
        });

        for (final Field field : injectFields) {
View Full Code Here

    private void autowireViaFields(final Object object, final Class<?> cls) {
        final List<Field> fields = Arrays.asList(cls.getDeclaredFields());
        final Iterable<Field> injectFields = Iterables.filter(fields, new Predicate<Field>() {
            @Override
            public boolean apply(Field input) {
                final Inject annotation = input.getAnnotation(javax.inject.Inject.class);
                return annotation != null;
            }
        });

        for (final Field field : injectFields) {
View Full Code Here

    private void autowireViaFields(final Object object, final List<Object> services, final Class<?> cls) {
        final List<Field> fields = Arrays.asList(cls.getDeclaredFields());
        final Iterable<Field> injectFields = Iterables.filter(fields, new Predicate<Field>() {
            @Override
            public boolean apply(Field input) {
                final Inject annotation = input.getAnnotation(javax.inject.Inject.class);
                return annotation != null;
            }
        });

        for (final Field field : injectFields) {
View Full Code Here

            Class<?> args[] = retVal.getParameterTypes();
            if (args.length != 0) return retVal;

            // Is zero length, but is it specifically marked?
            Inject i = retVal.getAnnotation(Inject.class);
            if (i != null) {
                return retVal;
            }

            // In this case, the default chose a zero-arg constructor since it could find no other
View Full Code Here

  private void scanInjectableConstructors(Class<?> beanClazz)
  {
    int annotatedConstructors = 0;
    for (Constructor<?> constructor : beanClazz.getConstructors())
    {
      Inject injectAnnotation = constructor.getAnnotation(Inject.class);
      if (injectAnnotation != null)
      {
        ++annotatedConstructors;
        if (annotatedConstructors > 1)
        {
View Full Code Here

          fieldDecls.add(field, field.getType(), namedAnno.value());
        }
        else
        {
          log.debug("    Using @Inject");
          Inject injectAnno = field.getAnnotation(Inject.class);
          if (injectAnno != null)
          {
            fieldDecls.add(field, field.getType(), null);
          }
        }
View Full Code Here

    for (Field field : clazz.getDeclaredFields()) {

      Param param = field.getAnnotation(Param.class);
      Output output = field.getAnnotation(Output.class);
      Workspace workspace = field.getAnnotation(Workspace.class);
      Inject inject = field.getAnnotation(Inject.class);

      int i =0;
      if (param != null) {
        i++;
      }
View Full Code Here

            Class<?> args[] = retVal.getParameterTypes();
            if (args.length != 0) return retVal;

            // Is zero length, but is it specifically marked?
            Inject i = retVal.getAnnotation(Inject.class);
            if (i != null) {
                return retVal;
            }

            // In this case, the default chose a zero-arg constructor since it could find no other
View Full Code Here

        for (Class<?> cls = type; !Object.class.equals(cls); cls = cls.getSuperclass()) {
            for (Field field : cls.getDeclaredFields()) {
                field.setAccessible(true);
                ImmutableList<Field> path = concat(fields, field);

                Inject injectAnnotation = field.getAnnotation(Inject.class);
                if (injectAnnotation != null) {
                    if (field.getType().equals(GlobalMetadata.class) ||
                            field.getType().equals(CommandGroupMetadata.class) ||
                            field.getType().equals(CommandMetadata.class)) {
                        injectionMetadata.metadataInjections.add(new Accessor(path));
View Full Code Here

TOP

Related Classes of javax.inject.Inject

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.