本文整理汇总了Java中com.google.template.soy.types.proto.SoyProtoValueConverter类的典型用法代码示例。如果您正苦于以下问题:Java SoyProtoValueConverter类的具体用法?Java SoyProtoValueConverter怎么用?Java SoyProtoValueConverter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SoyProtoValueConverter类属于com.google.template.soy.types.proto包,在下文中一共展示了SoyProtoValueConverter类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: provideSoyValueConverters
import com.google.template.soy.types.proto.SoyProtoValueConverter; //导入依赖的package包/类
/**
* Necessary to thread the proto value converters through to SoyTypeRegistry.
* -- because writing a method is totally easier than passing a parameter to
* a constructor. Thanks guice.
*/
@Provides
@Singleton
public List<SoyCustomValueConverter> provideSoyValueConverters(
SoyProtoValueConverter protoConverter) {
// Note: The order of data converters matters. Converters that only accept
// specific input types should come before converters that will convert
// anything.
return ImmutableList.<SoyCustomValueConverter>of(protoConverter);
}
示例2: setUp
import com.google.template.soy.types.proto.SoyProtoValueConverter; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
Guice.createInjector(
new AbstractModule() {
@Override
public void configure() {
newSetBinder(binder(), SoyTypeProvider.class)
.addBinding()
.to(SoyProtoTypeProvider.class);
}
@Provides
SoyProtoTypeProvider provideProtoTypeProvider() {
return new SoyProtoTypeProvider.Builder()
.addDescriptors(
ExampleExtendable.getDescriptor(),
KvPair.getDescriptor(),
KvMap.getDescriptor(),
Map.getDescriptor(),
SomeEmbeddedMessage.getDescriptor(),
Proto3Message.getDescriptor(),
SomeExtension.getDescriptor())
.buildNoFiles();
}
@Provides
List<SoyCustomValueConverter> provideCustomValueConverters(
SoyProtoValueConverter protoValueConverter) {
return ImmutableList.<SoyCustomValueConverter>of(protoValueConverter);
}
})
.injectMembers(this);
}
示例3: provideConverters
import com.google.template.soy.types.proto.SoyProtoValueConverter; //导入依赖的package包/类
@Provides
List<SoyCustomValueConverter> provideConverters(SoyProtoValueConverter protoConverter) {
return ImmutableList.of(protoConverter);
}