Package org.cruxframework.crux.core.client.ioc

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


   */
  private static void injectMethods(SourcePrinter srcWriter, JClassType type, String parentVariable, Set<String> added, String iocContainerVariable, Map<String, IocConfig<?>> configurations)
    {
      for (JMethod method : type.getMethods())
        {
          Inject inject = method.getAnnotation(Inject.class);
          if (inject != null && !method.isStatic())
          {
          String methodName = method.getName();
        if (!added.contains(methodName+"()"))
            {
View Full Code Here


    }

  @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

    {
      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

    }
    }

  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

        {
          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

   */
  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

TOP

Related Classes of org.cruxframework.crux.core.client.ioc.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.