当前位置: 首页>>代码示例>>Java>>正文


Java ObjectLocator类代码示例

本文整理汇总了Java中org.apache.tapestry5.ioc.ObjectLocator的典型用法代码示例。如果您正苦于以下问题:Java ObjectLocator类的具体用法?Java ObjectLocator怎么用?Java ObjectLocator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ObjectLocator类属于org.apache.tapestry5.ioc包,在下文中一共展示了ObjectLocator类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: provide

import org.apache.tapestry5.ioc.ObjectLocator; //导入依赖的package包/类
@Override
public <T> T provide(Class<T> objectType, AnnotationProvider annotationProvider, ObjectLocator locator) {

    TypeLiteral<T> type = TypeLiteral.get(objectType);
    List<Binding<T>> bindings = injector.findBindingsByType(type);

    for (Binding<T> binding : bindings) {

        Class<? extends Annotation> annotationType = binding.getKey().getAnnotationType();
        Annotation annotation = annotationType != null ? annotationProvider.getAnnotation(annotationType) : null;

        Key<T> key = annotation != null ? Key.get(type, annotation) : Key.get(type);
        if (key.equals(binding.getKey())) {
            return injector.getInstance(key);
        }
    }

    return null;
}
 
开发者ID:bootique,项目名称:bootique-tapestry,代码行数:20,代码来源:GuiceObjectProvider.java

示例2: configurePersistenceUnit

import org.apache.tapestry5.ioc.ObjectLocator; //导入依赖的package包/类
@Contribute(EntityManagerSource.class)
public static void configurePersistenceUnit(
        MappedConfiguration<String, PersistenceUnitConfigurer> cfg,
        final ObjectLocator objectLocator)
{
    PersistenceUnitConfigurer configurer = new PersistenceUnitConfigurer()
    {
        @Override
        public void configure(TapestryPersistenceUnitInfo unitInfo)
        {
            unitInfo.transactionType(PersistenceUnitTransactionType.RESOURCE_LOCAL)
                    .persistenceProviderClassName("org.eclipse.persistence.jpa.PersistenceProvider")
                    .excludeUnlistedClasses(false)
                    .addProperty("javax.persistence.jdbc.user", "sa")
                    .addProperty("javax.persistence.jdbc.password", "sa")
                    .addProperty("javax.persistence.jdbc.driver", "org.h2.Driver")
                    .addProperty("javax.persistence.jdbc.url", "jdbc:h2:mem:jpatest_eclipselink")
                    .addProperty("eclipselink.ddl-generation", "create-or-extend-tables")
                    .addProperty("eclipselink.logging.level", "FINE");

            unitInfo.getProperties().put("javax.persistence.bean.manager",
                    objectLocator.autobuild(TapestryCDIBeanManagerForJPAEntityListeners.class));
        }
    };
    cfg.add("jpatest", configurer);
}
 
开发者ID:satago,项目名称:tapestry-jpa-transactions,代码行数:27,代码来源:EclipseLinkJpaTestModule.java

示例3: configurePersistenceUnit

import org.apache.tapestry5.ioc.ObjectLocator; //导入依赖的package包/类
@Contribute(EntityManagerSource.class)
public static void configurePersistenceUnit(
        MappedConfiguration<String, PersistenceUnitConfigurer> cfg,
        final ObjectLocator objectLocator)
{
        PersistenceUnitConfigurer configurer = new PersistenceUnitConfigurer()
    {
        @Override
        public void configure(TapestryPersistenceUnitInfo unitInfo)
        {
            unitInfo.transactionType(PersistenceUnitTransactionType.RESOURCE_LOCAL)
                    .persistenceProviderClassName("org.hibernate.jpa.HibernatePersistenceProvider")
                    .excludeUnlistedClasses(false)
                    .addProperty("javax.persistence.jdbc.user", "sa")
                    .addProperty("javax.persistence.jdbc.password", "sa")
                    .addProperty("javax.persistence.jdbc.driver", "org.h2.Driver")
                    .addProperty("javax.persistence.jdbc.url", "jdbc:h2:mem:jpatest_hibernate")
                    .addProperty("hibernate.hbm2ddl.auto", "update")
                    .addProperty("hibernate.show_sql", "true");

            unitInfo.getProperties().put(AvailableSettings.CDI_BEAN_MANAGER,
                    objectLocator.autobuild(TapestryCDIBeanManagerForJPAEntityListeners.class));
        }
    };
    cfg.add("jpatest", configurer);
}
 
开发者ID:satago,项目名称:tapestry-jpa-transactions,代码行数:27,代码来源:HibernateJpaTestModule.java

示例4: provide

import org.apache.tapestry5.ioc.ObjectLocator; //导入依赖的package包/类
public <T> T provide(Class<T> objectType,
		AnnotationProvider annotationProvider, ObjectLocator locator) {

	CLIInput annotation = annotationProvider.getAnnotation(CLIInput.class);

	if (annotation == null) {
		return null;
	}

	if (annotation.position() < 0) {
		throw new ArrayIndexOutOfBoundsException(
				"You must provide a valid index for the CLIInput annotation to be used !");
	}

	Object value = optionSource.valueForInput(annotation.position());

	IntermediateType it = annotationProvider
			.getAnnotation(IntermediateType.class);

	if (it != null) {
		value = typeCoercer.coerce(value, it.value());
	}

	return typeCoercer.coerce(value, objectType);
}
 
开发者ID:alessiogambi,项目名称:tapestry5-cli,代码行数:26,代码来源:CLIInputObjectProvider.java

示例5: build

import org.apache.tapestry5.ioc.ObjectLocator; //导入依赖的package包/类
public static BabelCompiler build(final ObjectLocator objectLocator,
    @Symbol(ReactSymbols.USE_NODE_IF_AVAILABLE) final boolean useNodeIfAvailable) {
  boolean canUseNode = false;
  if (useNodeIfAvailable) {
    canUseNode = ReactUtilities.canUseNode();
  }
  return canUseNode ? objectLocator.autobuild(NodeBabelCompiler.class)
      : objectLocator.autobuild(RhinoBabelCompiler.class);
}
 
开发者ID:eddyson-de,项目名称:tapestry-react,代码行数:10,代码来源:ReactCoreModule.java

示例6: buildCsrfTokenRepository

import org.apache.tapestry5.ioc.ObjectLocator; //导入依赖的package包/类
public static CsrfTokenRepository buildCsrfTokenRepository(ObjectLocator objectLocator)
{
    // check if spring is there and if CsrfTokenRepository is registered
    if (SpringContextHelper.getSpringBean(objectLocator,
        "org.springframework.security.web.csrf.CsrfTokenRepository") != null)
    {
        return objectLocator.proxy(CsrfTokenRepository.class, SpringCsrfTokenRepository.class);
    }
    else
    {
        return objectLocator.proxy(CsrfTokenRepository.class, SessionCsrfTokenRepository.class);
    }
}
 
开发者ID:porscheinformatik,项目名称:tapestry-csrf-protection,代码行数:14,代码来源:CsrfProtectionModule.java

示例7: provide

import org.apache.tapestry5.ioc.ObjectLocator; //导入依赖的package包/类
public <T> T provide(Class<T> objectType,
		AnnotationProvider annotationProvider, ObjectLocator locator) {
	CLIOption annotation = annotationProvider
			.getAnnotation(CLIOption.class);

	if (annotation == null) {
		return null;
	}

	Object value = null;
	if (!annotation.name().equals("")) {
		value = optionSource.valueForOption(annotation.name());
	} else if (!annotation.longName().equals("")) {
		value = optionSource.valueForOption(annotation.longName());
	} else {
		throw new RuntimeException(
				"You must provide either a short or a long name for the CLIOption annotation to be used !");
	}

	IntermediateType it = annotationProvider
			.getAnnotation(IntermediateType.class);

	if (it != null) {
		value = typeCoercer.coerce(value, it.value());
	}

	return typeCoercer.coerce(value, objectType);
}
 
开发者ID:alessiogambi,项目名称:tapestry5-cli,代码行数:29,代码来源:CLIOptionObjectProvider.java

示例8: TapestryConstraintValidatorFactory

import org.apache.tapestry5.ioc.ObjectLocator; //导入依赖的package包/类
public TapestryConstraintValidatorFactory(ObjectLocator locator) {
	this.locator = locator;
}
 
开发者ID:alessiogambi,项目名称:tapestry5-cli,代码行数:4,代码来源:TapestryConstraintValidatorFactory.java


注:本文中的org.apache.tapestry5.ioc.ObjectLocator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。