本文整理汇总了Java中com.google.gson.GsonBuilder.disableHtmlEscaping方法的典型用法代码示例。如果您正苦于以下问题:Java GsonBuilder.disableHtmlEscaping方法的具体用法?Java GsonBuilder.disableHtmlEscaping怎么用?Java GsonBuilder.disableHtmlEscaping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gson.GsonBuilder
的用法示例。
在下文中一共展示了GsonBuilder.disableHtmlEscaping方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: unpack
import com.google.gson.GsonBuilder; //导入方法依赖的package包/类
public void unpack(@NonNull final JSONObject payload) {
if (DEBUG) {
MyLog.i(CLS_NAME, "unpacking");
}
final GsonBuilder builder = new GsonBuilder();
builder.disableHtmlEscaping();
builder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);
final Gson gson = builder.create();
nluNuance = gson.fromJson(payload.toString(), new TypeToken<NLUNuance>() {
}.getType());
new NLUCoerce(getNLUNuance(), getContext(), getSupportedLanguage(), getVRLocale(), getTTSLocale(),
getConfidenceArray(), getResultsArray()).coerce();
}
示例2: unpack
import com.google.gson.GsonBuilder; //导入方法依赖的package包/类
public void unpack(@NonNull final JSONObject payload) {
if (DEBUG) {
MyLog.i(CLS_NAME, "unpacking");
}
final GsonBuilder builder = new GsonBuilder();
builder.disableHtmlEscaping();
builder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);
final Gson gson = builder.create();
nluSaiy = gson.fromJson(payload.toString(), new TypeToken<NLUSaiy>() {
}.getType());
new NLUCoerce(getNLUSaiy(), getContext(), getSupportedLanguage(), getVRLocale(), getTTSLocale(),
getConfidenceArray(), getResultsArray()).coerce();
}
示例3: serialize
import com.google.gson.GsonBuilder; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public String serialize() {
final GsonBuilder builder = new GsonBuilder();
builder.excludeFieldsWithoutExposeAnnotation();
builder.disableHtmlEscaping();
final Gson gson = builder.create();
return gson.toJson(this);
}
示例4: json
import com.google.gson.GsonBuilder; //导入方法依赖的package包/类
private String json()
{
GsonBuilder builder = new GsonBuilder();
builder.setPrettyPrinting();
builder.disableHtmlEscaping();
Gson gson = builder.create();
return gson.toJson(this);
}
示例5: create
import com.google.gson.GsonBuilder; //导入方法依赖的package包/类
public static final Gson create(boolean pretty) {
GsonBuilder builder = new GsonBuilder();
builder.serializeNulls();
builder.disableHtmlEscaping();
// Install MongoDB / BSON serializers
tryToAddSerializers("io.datatree.dom.adapters.JsonGsonBsonSerializers", builder);
// Install serializers for Apache Cassandra
addSerializer(builder, InetAddress.class, (value) -> {
return new JsonPrimitive(value.getCanonicalHostName());
});
addSerializer(builder, Inet4Address.class, (value) -> {
return new JsonPrimitive(value.getCanonicalHostName());
});
addSerializer(builder, Inet6Address.class, (value) -> {
return new JsonPrimitive(value.getCanonicalHostName());
});
// Date serializer
if (Config.USE_TIMESTAMPS) {
builder.setDateFormat(Config.TIMESTAMP_FORMAT);
} else {
// Milliseconds since epoch Jan 1 , 1970 00:00:00 UTC
addSerializer(builder, Date.class, (value) -> {
return new JsonPrimitive(value.getTime());
});
}
// BASE64 serializer
addSerializer(builder, byte[].class, (value) -> {
return new JsonPrimitive(BASE64.encode(value));
});
// Pretty printing
if (pretty) {
builder.setPrettyPrinting();
}
return builder.create();
}
示例6: getGson
import com.google.gson.GsonBuilder; //导入方法依赖的package包/类
public static Gson getGson() {
GsonBuilder builder = new GsonBuilder();
builder.disableHtmlEscaping();
return builder.create();
}