Examples of Inject


Examples of org.cruxframework.crux.core.client.ioc.Inject

    }

  @SuppressWarnings("deprecation")
    private static String getFieldInjectionExpression(JField field, String iocContainerVariable, Map<String, IocConfig<?>> configurations)
    {
    Inject inject = field.getAnnotation(Inject.class);
    if (inject != null)
    {
      JType fieldType = field.getType();
      if (!field.isStatic())
      {
        if (fieldType.isClassOrInterface() != null)
        {
          String fieldTypeName = fieldType.getQualifiedSourceName();
          IocConfigImpl<?> iocConfig = (IocConfigImpl<?>) configurations.get(fieldTypeName);
          if (iocConfig != null)
          {
            if (inject.scope().equals(org.cruxframework.crux.core.client.ioc.Inject.Scope.DEFAULT))
            {
              return iocContainerVariable+".get"+fieldTypeName.replace('.', '_')+
                  "("+Scope.class.getCanonicalName()+"."+iocConfig.getScope().name()+", null)";
            }
            return iocContainerVariable+".get"+fieldTypeName.replace('.', '_')+
                "("+Scope.class.getCanonicalName()+"."+getScopeName(inject.scope())+", "+EscapeUtils.quote(inject.subscope())+")";
          }
          else
          {
            return "GWT.create("+fieldTypeName+".class)";
          }
View Full Code Here

Examples of org.cruxframework.crux.core.client.ioc.Inject

    {
      String fieldTypeName = parameterType.getQualifiedSourceName();
      IocConfigImpl<?> iocConfig = (IocConfigImpl<?>) configurations.get(fieldTypeName);
      if (iocConfig != null)
      {
        Inject inject = getInjectAnnotation(parameter);
        if (inject.scope().equals(org.cruxframework.crux.core.client.ioc.Inject.Scope.DEFAULT))
        {
          return iocContainerVariable+".get"+fieldTypeName.replace('.', '_')+
              "("+Scope.class.getCanonicalName()+"."+iocConfig.getScope().name()+", null)";
        }
        return iocContainerVariable+".get"+fieldTypeName.replace('.', '_')+
            "("+Scope.class.getCanonicalName()+"."+getScopeName(inject.scope())+", "+EscapeUtils.quote(inject.subscope())+")";
      }
      else
      {
        return "GWT.create("+fieldTypeName+".class)";
      }
View Full Code Here

Examples of org.cruxframework.crux.core.client.ioc.Inject

    }
    }

  private static Inject getInjectAnnotation(JParameter parameter)
    {
    Inject result = parameter.getAnnotation(Inject.class);
    if (result == null)
    {
      result = parameter.getEnclosingMethod().getAnnotation(Inject.class);
    }
    return result;
View Full Code Here

Examples of org.cruxframework.crux.core.client.ioc.Inject

        {
          added.add(fieldName);
          Class<?> fieldType = field.getType();
          if (isBindable(fieldType, false))
          {
            Inject inject = field.getAnnotation(Inject.class);
            if (inject != null)
            {
              if (path.contains(fieldType.getCanonicalName()))
              {
                throw new IoCException("IoC Create Looping Error between classes ["+type.getCanonicalName()+"] and ["+fieldType.getCanonicalName()+"].");
View Full Code Here

Examples of org.cruxframework.crux.core.client.ioc.Inject

   */
  private static void bindImplicityInjectionsForMethods(Class<?> type, Set<String> added, Set<String> path, Map<String, IocConfig<?>> configurations)
    {
      for (Method method : type.getDeclaredMethods())
      {
        Inject inject = method.getAnnotation(Inject.class);
        Class<?>[] parameterTypes = method.getParameterTypes();
      if (inject != null && !Modifier.isAbstract(method.getModifiers()) && parameterTypes != null && parameterTypes.length > 0)
        {
          if (!added.contains(method.toString()))
          {
View Full Code Here

Examples of org.elasticsearch.common.inject.Inject

    }

    InjectionPoint(TypeLiteral<?> type, Method method) {
        this.member = method;

        Inject inject = method.getAnnotation(Inject.class);
        this.optional = inject.optional();

        this.dependencies = forMember(method, type, method.getParameterAnnotations());
    }
View Full Code Here

Examples of org.elasticsearch.common.inject.Inject

    }

    InjectionPoint(TypeLiteral<?> type, Field field) {
        this.member = field;

        Inject inject = field.getAnnotation(Inject.class);
        this.optional = inject.optional();

        Annotation[] annotations = field.getAnnotations();

        Errors errors = new Errors(field);
        Key<?> key = null;
View Full Code Here

Examples of org.elasticsearch.common.inject.Inject

        Class<?> rawType = getRawType(type.getType());
        Errors errors = new Errors(rawType);

        Constructor<?> injectableConstructor = null;
        for (Constructor<?> constructor : rawType.getDeclaredConstructors()) {
            Inject inject = constructor.getAnnotation(Inject.class);
            if (inject != null) {
                if (inject.optional()) {
                    errors.optionalConstructor(constructor);
                }

                if (injectableConstructor != null) {
                    errors.tooManyConstructors(rawType);
View Full Code Here

Examples of org.elasticsearch.common.inject.Inject

        for (M member : factory.getMembers(getRawType(typeLiteral.getType()))) {
            if (isStatic(member) != statics) {
                continue;
            }

            Inject inject = member.getAnnotation(Inject.class);
            if (inject == null) {
                continue;
            }

            try {
                injectionPoints.add(factory.create(typeLiteral, member, errors));
            } catch (ConfigurationException ignorable) {
                if (!inject.optional()) {
                    errors.merge(ignorable.getErrorMessages());
                }
            }
        }
    }
View Full Code Here

Examples of org.jboss.as.service.descriptor.JBossServiceAttributeConfig.Inject

        final JBossServiceAttributeConfig[] attributeConfigs = mBeanConfig.getAttributeConfigs();
        if (attributeConfigs != null) {
            final Service<Object> createDestroyService = mBeanServices.getCreateDestroyService();
            for (final JBossServiceAttributeConfig attributeConfig : attributeConfigs) {
                final String propertyName = attributeConfig.getName();
                final Inject injectConfig = attributeConfig.getInject();
                final ValueFactory valueFactoryConfig = attributeConfig.getValueFactory();

                if (injectConfig != null) {
                    final Value<?> value = getValue(injectConfig, mBeanClassHierarchy);
                    final Injector<Object> injector = getPropertyInjector(propertyName, mBeanClassHierarchy, createDestroyService, value);
                    mBeanServices.addDependency(injectConfig.getBeanName(), injector);
                } else if (valueFactoryConfig != null) {
                    final Value<?> value = getValue(valueFactoryConfig, mBeanClassHierarchy, classLoader);
                    final Injector<Object> injector = getPropertyInjector(propertyName, mBeanClassHierarchy, createDestroyService, value);
                    mBeanServices.addDependency(valueFactoryConfig.getBeanName(), injector);
                } else {
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.