本文整理汇总了Java中com.owlike.genson.GensonBuilder类的典型用法代码示例。如果您正苦于以下问题:Java GensonBuilder类的具体用法?Java GensonBuilder怎么用?Java GensonBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GensonBuilder类属于com.owlike.genson包,在下文中一共展示了GensonBuilder类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: create
import com.owlike.genson.GensonBuilder; //导入依赖的package包/类
public static final Genson create(boolean pretty) {
GensonBuilder builder = new GensonBuilder();
// Install MongoDB / BSON serializers
tryToAddSerializers("io.datatree.dom.adapters.JsonGensonBsonSerializers", builder);
// Install serializers for Apache Cassandra
addSerializer(builder, InetAddress.class, (value, writer, ctx) -> {
writer.writeString(value.getCanonicalHostName());
});
addSerializer(builder, Inet4Address.class, (value, writer, ctx) -> {
writer.writeString(value.getCanonicalHostName());
});
addSerializer(builder, Inet6Address.class, (value, writer, ctx) -> {
writer.writeString(value.getCanonicalHostName());
});
// Set Date format
builder.useDateAsTimestamp(!Config.USE_TIMESTAMPS);
if (Config.USE_TIMESTAMPS) {
builder.useDateFormat(new SimpleDateFormat(Config.TIMESTAMP_FORMAT));
}
builder.useIndentation(pretty);
return builder.create();
}
开发者ID:berkesa,项目名称:datatree-adapters,代码行数:26,代码来源:JsonGenson.java
示例2: JobSettingsImpl
import com.owlike.genson.GensonBuilder; //导入依赖的package包/类
@Inject
JobSettingsImpl(
Converter<DirType> dirTypeConverter
) {
this.logger = LogManager.getLogger(getClass());
this.serializer = new GensonSerializer<>(Queue.class, new GensonBuilder()
.acceptSingleValueAsList(true)
.useIndentation(true)
.useFields(true, VisibilityFilter.PRIVATE)
.useMethods(false)
.useClassMetadata(true)
.useRuntimeType(true)
.addAlias("Queue", Queue.class)
.addAlias("Job", JobImpl.class)
.addAlias("VideoPackage", VideoPackageImpl.class)
.addAlias("File", FileContainer.class)
.withConverter(dirTypeConverter, DirType.class)
.withConverter(new DateConverter(), LocalDateTime.class)
);
}
开发者ID:ccremer,项目名称:clusterbrake,代码行数:21,代码来源:JobSettingsImpl.java
示例3: GensonSerializer
import com.owlike.genson.GensonBuilder; //导入依赖的package包/类
public GensonSerializer(Class<T> clazz, GensonBuilder gensonBuilder) {
if (gensonBuilder == null) {
this.genson = new GensonBuilder().useIndentation(true).create();
} else {
this.genson = gensonBuilder.create();
}
this.clazz = clazz;
}
开发者ID:ccremer,项目名称:clusterbrake,代码行数:9,代码来源:GensonSerializer.java
示例4: createBeanDescriptorProvider
import com.owlike.genson.GensonBuilder; //导入依赖的package包/类
@Override
public BeanDescriptorProvider createBeanDescriptorProvider(ContextualConverterFactory contextualConverterFactory,
BeanPropertyFactory propertyFactory, BeanMutatorAccessorResolver propertyResolver,
PropertyNameResolver nameResolver, GensonBuilder builder) {
return new DefaultBeanDescriptorProvider(contextualConverterFactory, propertyFactory, propertyResolver,
nameResolver, true, true, true);
}
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:8,代码来源:DefaultGensonBundle.java
示例5: GensonHttpMessageConverter
import com.owlike.genson.GensonBuilder; //导入依赖的package包/类
public GensonHttpMessageConverter() {
this.supportedMediaTypes.add(MediaType.APPLICATION_JSON);
this.supportedMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
this.supportedMediaTypes.add(new MediaType("application", "*+json", DEFAULT_CHARSET));
this.genson = new GensonBuilder()
.useFields(true, VisibilityFilter.PRIVATE)
.useMethods(false)
.useClassMetadata(true)
.useRuntimeType(true)
.create();
}
开发者ID:camueller,项目名称:SmartApplianceEnabler,代码行数:13,代码来源:GensonHttpMessageConverter.java
示例6: configure
import com.owlike.genson.GensonBuilder; //导入依赖的package包/类
@Override
public void configure(GensonBuilder builder) {
builder.setSkipNull(true);
configureDateFormat(builder);
configureSchema(builder);
configureConverters(builder);
}
开发者ID:feroult,项目名称:yawp,代码行数:8,代码来源:BaseGensonBundle.java
示例7: addSerializer
import com.owlike.genson.GensonBuilder; //导入依赖的package包/类
public static final <T> void addSerializer(GensonBuilder builder, Class<T> type, OneWayConverter<T> converter) {
builder.withConverter(converter, type);
}
开发者ID:berkesa,项目名称:datatree-adapters,代码行数:4,代码来源:JsonGenson.java
示例8: accept
import com.owlike.genson.GensonBuilder; //导入依赖的package包/类
@Override
public void accept(GensonBuilder builder) {
addSerializer(builder, BsonBoolean.class, (value, writer, ctx) -> {
writer.writeBoolean(value.getValue());
});
addSerializer(builder, BsonDateTime.class, (value, writer, ctx) -> {
if (Config.USE_TIMESTAMPS) {
writer.writeString(DataConverterRegistry.convert(String.class, new Date(value.getValue())));
} else {
writer.writeNumber(value.getValue());
}
});
addSerializer(builder, BsonDouble.class, (value, writer, ctx) -> {
writer.writeNumber(value.getValue());
});
addSerializer(builder, BsonInt32.class, (value, writer, ctx) -> {
writer.writeNumber(value.getValue());
});
addSerializer(builder, BsonInt64.class, (value, writer, ctx) -> {
writer.writeNumber(value.getValue());
});
addSerializer(builder, BsonNull.class, (value, writer, ctx) -> {
writer.writeNull();
});
addSerializer(builder, BsonRegularExpression.class, (value, writer, ctx) -> {
writer.writeString(value.getPattern());
});
addSerializer(builder, BsonString.class, (value, writer, ctx) -> {
writer.writeString(value.getValue());
});
addSerializer(builder, BsonTimestamp.class, (value, writer, ctx) -> {
if (Config.USE_TIMESTAMPS) {
writer.writeString(DataConverterRegistry.convert(String.class, new Date(value.getTime() * 1000L)));
} else {
writer.writeNumber(value.getTime());
}
});
addSerializer(builder, BsonUndefined.class, (value, writer, ctx) -> {
writer.writeNull();
});
addSerializer(builder, Binary.class, (value, writer, ctx) -> {
writer.writeString(BASE64.encode(value.getData()));
});
addSerializer(builder, Code.class, (value, writer, ctx) -> {
writer.writeString(value.getCode());
});
addSerializer(builder, Decimal128.class, (value, writer, ctx) -> {
writer.writeNumber(value.bigDecimalValue());
});
addSerializer(builder, ObjectId.class, (value, writer, ctx) -> {
writer.writeString(value.toHexString());
});
addSerializer(builder, Symbol.class, (value, writer, ctx) -> {
writer.writeString(value.getSymbol());
});
}
开发者ID:berkesa,项目名称:datatree-adapters,代码行数:73,代码来源:JsonGensonBsonSerializers.java
示例9: configure
import com.owlike.genson.GensonBuilder; //导入依赖的package包/类
@Override
public void configure(GensonBuilder builder) {
}
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:4,代码来源:DefaultGensonBundle.java
示例10: checkGenson
import com.owlike.genson.GensonBuilder; //导入依赖的package包/类
private void checkGenson() {
if (genson == null)
genson = new GensonBuilder().setSkipNull(true)
.useIndentation(true) // DEBUG ONLY!
.create();
}
开发者ID:tarzasai,项目名称:Uoccin,代码行数:7,代码来源:Service.java
示例11: configureDateFormat
import com.owlike.genson.GensonBuilder; //导入依赖的package包/类
private void configureDateFormat(GensonBuilder builder) {
builder.useDateAsTimestamp(false);
builder.useDateFormat(new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"));
}
开发者ID:feroult,项目名称:yawp,代码行数:5,代码来源:BaseGensonBundle.java
示例12: configureSchema
import com.owlike.genson.GensonBuilder; //导入依赖的package包/类
private void configureSchema(GensonBuilder builder) {
builder.useMethods(false);
builder.useFields(true, new VisibilityFilter(Modifier.TRANSIENT, Modifier.STATIC));
}
开发者ID:feroult,项目名称:yawp,代码行数:5,代码来源:BaseGensonBundle.java
示例13: configureConverters
import com.owlike.genson.GensonBuilder; //导入依赖的package包/类
private void configureConverters(GensonBuilder builder) {
IdRefConverters.configure(builder);
LazyJsonConverters.configure(builder);
builder.withContextualFactory(new CustomContextualFactory());
builder.withConverterFactory(new CustomMapConverterFactory());
}
开发者ID:feroult,项目名称:yawp,代码行数:7,代码来源:BaseGensonBundle.java
注:本文中的com.owlike.genson.GensonBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论