colesico.framework.ioc.ioclet.Factory类的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中colesico.framework.ioc.ioclet.Factory类的一些代码示例,展示了Factory类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Factory类的具体详情如下:
包路径:colesico.framework.ioc.ioclet.Factory
类名称:Factory

Factory介绍

[英]Factory superclass. Should be expanded by all the factories. Factory "supplies" the instance of class T for IoC container. T he factories are provided for the IoC container with IoC container modules - ioclets
[中]工厂超类。所有的工厂都应该扩建。工厂为IoC容器“提供”T类实例。工厂为带有IoC容器模块(ioclets)的IoC容器提供

代码示例

代码示例来源:origin: net.colesico.framework/colesico-ioc

@Override
  public T get(Object message) {
    return factory.get(message);
  }
}

代码示例来源:origin: net.colesico.framework/colesico-ioc

protected void activate(Factory factory, Key key) {
    try {

      Factory s = factory;
      while (s != null) {
        s.activate(this);
        s = s.next();
      }
    } catch (StackOverflowError soe) {
      throw new IocException(String.format(CIRCULAR_DEP_ERR_MSG, key.toString()));
    }
  }
}

代码示例来源:origin: net.colesico.framework/colesico-ioc

@Override
public <T> void add(Factory<T> prodlet) {
  Factory oldItem = factoriesMap.put(state.key, prodlet);
  if (oldItem != null) {
    if (state.polyproducing) {
      prodlet.setNext(oldItem);
    } else {
      throw new IocException("Factory is overridden for key: " + state.key);
    }
  }
  ranksMap.put(state.key, state.rank);
}

代码示例来源:origin: net.colesico.framework/colesico-ioc

@Override
  public T next() {
    if (factory != null) {
      T instance = factory.get(message);
      factory = factory.next();
      return instance;
    } else {
      throw new IocException("Polysupplier hasn't more elements");
    }
  }
}

代码示例来源:origin: net.colesico.framework/colesico-ioc

@Override
public T get() {
  return factory.get(message);
}

代码示例来源:origin: net.colesico.framework/colesico-ioc

protected void activateFactories(AdvancedIoc ioc, Map<Key<?>, Factory<?>> factories) {
  Key<?> currentKey = null;
  try {
    for (Map.Entry<Key<?>, Factory<?>> e : factories.entrySet()) {
      currentKey = e.getKey();
      Factory<?> supl = e.getValue();
      while (supl != null) {
        supl.activate(ioc);
        supl = supl.next();
      }
    }
  } catch (StackOverflowError soe) {
    throw new IocException("Circular dependence for key: " + currentKey);
  }
}

代码示例来源:origin: net.colesico.framework/colesico-ioc

@Override
public <T> T instanceOrNull(Key<T> key, Object message) {
  Factory<T> factory = (Factory<T>) factories.get(key);
  if (factory == null) {
    return null;
  }
  return factory.get(message);
}

代码示例来源:origin: net.colesico.framework/colesico-translation

@Override
  public final TranslationKitImpl create(final Object message) {
    return new TranslationKitImpl(this.resourceKitFac.get(message),this.threadScopeFac.get(message));
  }
};

代码示例来源:origin: net.colesico.framework/colesico-ioc

@Override
  public final T get(Object message) {
    final Scope scope = scopeFac.get(message);
    return (T) scope.get(instanceKey, this, message);
  }
}

代码示例来源:origin: net.colesico.framework/colesico-weblet

@Override
  public final WebletDataPortImpl create(final Object message) {
    return new WebletDataPortImpl(this.iocFac.get(message));
  }
};

代码示例来源:origin: net.colesico.framework/colesico-ioc

@Override
public <T> T instanceOrNull(Key<T> key, Object message) {
  Factory<T> factory = (Factory<T>) factories.get(key);
  if (factory == null) {
    return null;
  }
  activate(factory, key);
  return factory.get(message);
}

代码示例来源:origin: net.colesico.framework/colesico-weblet

@Override
  public final VariousWriter create(final Object message) {
    return new VariousWriter(this.navigationWriterFac.get(message),this.stringWriterFac.get(message),this.binaryWriterFac.get(message),new DefaultProvider(this.responseProvFac,message));
  }
};

代码示例来源:origin: net.colesico.framework/colesico-ioc

@Override
public <T> T instance(Key<T> key, Object message) throws UnsatisfiedInjectionException {
  Factory<T> factory = (Factory<T>) factories.get(key);
  if (factory == null) {
    throw new UnsatisfiedInjectionException(key);
  }
  return factory.get(message);
}

代码示例来源:origin: net.colesico.framework/colesico-weblet

@Override
  public final WebletMessagesImpl create(final Object message) {
    return new WebletMessagesImpl(this.translationKitFac.get(message));
  }
};

代码示例来源:origin: net.colesico.framework/colesico-validation

@Override
  public final ValidatorMessagesImpl create(final Object message) {
    return new ValidatorMessagesImpl(this.translationKitFac.get(message));
  }
};

代码示例来源:origin: net.colesico.framework/colesico-resource

@Override
  public final ResourceKitImpl create(final Object message) {
    return new ResourceKitImpl(this.localizingToolFac.get(message),this.rewritingToolFac.get(message),this.evaluationToolFac.get(message),new DefaultPolysupplier(this.configsFac));
  }
};

代码示例来源:origin: net.colesico.framework/colesico-restlet

@Override
  public final RestletDataPortImpl create(final Object message) {
    return new RestletDataPortImpl(this.iocFac.get(message),new DefaultProvider(this.httpContextProvFac,message),this.jsonConverterFac.get(message));
  }
};

代码示例来源:origin: net.colesico.framework/colesico-ioc

@Override
public <T> T instance(Key<T> key, Object message) {
  Factory<T> factory = (Factory<T>) factories.get(key);
  if (factory == null) {
    throw new UnsatisfiedInjectionException(key);
  }
  activate(factory, key);
  return factory.get(message);
}

代码示例来源:origin: net.colesico.framework/colesico-profile

@Override
  public final ProfileKit create(final Object message) {
    return producer.get().getProfileKit(this.implFac.get(message));
  }
};

代码示例来源:origin: net.colesico.framework/colesico-profile

@Override
  public final Profile get(final Object message) {
    return producer.get().getProfile(this.kitFac.get(message));
  }
};

相关文章

Factory类方法