项目:CustomWorldGen
文件:LootEntryItem.java
@H_502_5@
protected void serialize(JsonObject json,JsonSerializationContext context)
{
if (this.functions != null && this.functions.length > 0)
{
json.add("functions",context.serialize(this.functions));
}
ResourceLocation resourcelocation = (ResourceLocation)Item.REGISTRY.getNameForObject(this.item);
if (resourcelocation == null)
{
throw new IllegalArgumentException("Can\'t serialize unkNown item " + this.item);
}
else
{
json.addProperty("name",resourcelocation.toString());
}
}
@H_502_5@
@H_502_5@
项目:yggdrasil
文件:ProfilePropertyMapSerializer.java
@H_502_5@
@Override
public JsonElement serialize(final ProfilePropertyMap src,final Type typeOfSrc,final JsonSerializationContext context) {
final JsonArray result = new JsonArray();
for(final ProfileProperty property : src.values()) {
final JsonObject object = new JsonObject();
object.addProperty("name",property.name());
object.addProperty("value",property.value());
@Nullable final String signature = property.signature();
if(signature != null) {
object.addProperty("signature",signature);
}
result.add(object);
}
return result;
}
@H_502_5@
@H_502_5@
项目:Phoenix-for-VK
文件:AttachmentsDboAdapter.java
@H_502_5@
@Override
public JsonElement serialize(AttachmentsEntity attachmentsEntity,Type type,JsonSerializationContext context) {
List<Entity> entities = attachmentsEntity.getEntities();
JsonArray array = new JsonArray(entities.size());
for(Entity entity : entities){
int dbotype = AttachmentsTypes.typeForInstance(entity);
JsonObject o = new JsonObject();
o.add(KEY_ENTITY_TYPE,new JsonPrimitive(dbotype));
o.add(KEY_ENTITY,context.serialize(entity));
array.add(o);
}
return array;
}
@H_502_5@
@H_502_5@
项目:BaseClient
文件:ServerStatusResponse.java
@H_502_5@
public JsonElement serialize(ServerStatusResponse p_serialize_1_,Type p_serialize_2_,JsonSerializationContext p_serialize_3_)
{
JsonObject jsonobject = new JsonObject();
if (p_serialize_1_.getServerDescription() != null)
{
jsonobject.add("description",p_serialize_3_.serialize(p_serialize_1_.getServerDescription()));
}
if (p_serialize_1_.getPlayerCountData() != null)
{
jsonobject.add("players",p_serialize_3_.serialize(p_serialize_1_.getPlayerCountData()));
}
if (p_serialize_1_.getProtocolVersionInfo() != null)
{
jsonobject.add("version",p_serialize_3_.serialize(p_serialize_1_.getProtocolVersionInfo()));
}
if (p_serialize_1_.getFavicon() != null)
{
jsonobject.addProperty("favicon",p_serialize_1_.getFavicon());
}
return jsonobject;
}
@H_502_5@
@H_502_5@
项目:BaseClient
文件:ServerStatusResponse.java
@H_502_5@
public JsonElement serialize(ServerStatusResponse.PlayerCountData p_serialize_1_,JsonSerializationContext p_serialize_3_)
{
JsonObject jsonobject = new JsonObject();
jsonobject.addProperty("max",(Number)Integer.valueOf(p_serialize_1_.getMaxPlayers()));
jsonobject.addProperty("online",(Number)Integer.valueOf(p_serialize_1_.getonlinePlayerCount()));
if (p_serialize_1_.getPlayers() != null && p_serialize_1_.getPlayers().length > 0)
{
JsonArray jsonarray = new JsonArray();
for (int i = 0; i < p_serialize_1_.getPlayers().length; ++i)
{
JsonObject jsonobject1 = new JsonObject();
UUID uuid = p_serialize_1_.getPlayers()[i].getId();
jsonobject1.addProperty("id",uuid == null ? "" : uuid.toString());
jsonobject1.addProperty("name",p_serialize_1_.getPlayers()[i].getName());
jsonarray.add(jsonobject1);
}
jsonobject.add("sample",jsonarray);
}
return jsonobject;
}
@H_502_5@
@H_502_5@
项目:Backmemed
文件:EnchantRandomly.java
@H_502_5@
public void serialize(JsonObject object,EnchantRandomly functionClazz,JsonSerializationContext serializationContext)
{
if (!functionClazz.enchantments.isEmpty())
{
JsonArray jsonarray = new JsonArray();
for (Enchantment enchantment : functionClazz.enchantments)
{
ResourceLocation resourcelocation = (ResourceLocation)Enchantment.REGISTRY.getNameForObject(enchantment);
if (resourcelocation == null)
{
throw new IllegalArgumentException("Don\'t kNow how to serialize enchantment " + enchantment);
}
jsonarray.add(new JsonPrimitive(resourcelocation.toString()));
}
object.add("enchantments",jsonarray);
}
}
@H_502_5@
@H_502_5@
项目:Wechat-Group
文件:WxMpTemplateMessageGsonAdapter.java
@H_502_5@
@Override
public JsonElement serialize(WxMpTemplateMessage message,Type typeOfSrc,JsonSerializationContext context) {
JsonObject messageJson = new JsonObject();
messageJson.addProperty("touser",message.getToUser());
messageJson.addProperty("template_id",message.getTemplateId());
if (message.getUrl() != null) {
messageJson.addProperty("url",message.getUrl());
}
JsonObject data = new JsonObject();
messageJson.add("data",data);
for (WxMpTemplateData datum : message.getData()) {
JsonObject dataJson = new JsonObject();
dataJson.addProperty("value",datum.getValue());
if (datum.getColor() != null) {
dataJson.addProperty("color",datum.getColor());
}
data.add(datum.getName(),dataJson);
}
return messageJson;
}
@H_502_5@
@H_502_5@
项目:Decompiledminecraft
文件:ServerStatusResponse.java
@H_502_5@
public JsonElement serialize(ServerStatusResponse.PlayerCountData p_serialize_1_,jsonarray);
}
return jsonobject;
}
@H_502_5@
@H_502_5@
项目:Backmemed
文件:LootPool.java
@H_502_5@
public JsonElement serialize(LootPool p_serialize_1_,JsonSerializationContext p_serialize_3_)
{
JsonObject jsonobject = new JsonObject();
jsonobject.add("entries",p_serialize_3_.serialize(p_serialize_1_.lootEntries));
jsonobject.add("rolls",p_serialize_3_.serialize(p_serialize_1_.rolls));
if (p_serialize_1_.bonusRolls.getMin() != 0.0F && p_serialize_1_.bonusRolls.getMax() != 0.0F)
{
jsonobject.add("bonus_rolls",p_serialize_3_.serialize(p_serialize_1_.bonusRolls));
}
if (!ArrayUtils.isEmpty((Object[])p_serialize_1_.poolConditions))
{
jsonobject.add("conditions",p_serialize_3_.serialize(p_serialize_1_.poolConditions));
}
return jsonobject;
}
@H_502_5@
@H_502_5@
项目:BaseClient
文件:PackMetadataSectionSerializer.java
@H_502_5@
public JsonElement serialize(PackMetadataSection p_serialize_1_,JsonSerializationContext p_serialize_3_)
{
JsonObject jsonobject = new JsonObject();
jsonobject.addProperty("pack_format",(Number)Integer.valueOf(p_serialize_1_.getPackFormat()));
jsonobject.add("description",p_serialize_3_.serialize(p_serialize_1_.getPackDescription()));
return jsonobject;
}
@H_502_5@
@H_502_5@
项目:mapBox-events-android
文件:NavigationMetadataSerializer.java
@H_502_5@
@Override
public JsonElement serialize(NavigationMetadata src,JsonSerializationContext context) {
JsonObject Metadata = new JsonObject();
serializerequired(src,Metadata);
serializeOptional(src,Metadata);
return Metadata;
}
@H_502_5@
@H_502_5@
项目:CustomWorldGen
文件:AnimationMetadataSectionSerializer.java
@H_502_5@
public JsonElement serialize(AnimationMetadataSection p_serialize_1_,JsonSerializationContext p_serialize_3_)
{
JsonObject jsonobject = new JsonObject();
jsonobject.addProperty("frametime",(Number)Integer.valueOf(p_serialize_1_.getFrameTime()));
if (p_serialize_1_.getFrameWidth() != -1)
{
jsonobject.addProperty("width",(Number)Integer.valueOf(p_serialize_1_.getFrameWidth()));
}
if (p_serialize_1_.getFrameHeight() != -1)
{
jsonobject.addProperty("height",(Number)Integer.valueOf(p_serialize_1_.getFrameHeight()));
}
if (p_serialize_1_.getFrameCount() > 0)
{
JsonArray jsonarray = new JsonArray();
for (int i = 0; i < p_serialize_1_.getFrameCount(); ++i)
{
if (p_serialize_1_.frameHasTime(i))
{
JsonObject jsonobject1 = new JsonObject();
jsonobject1.addProperty("index",(Number)Integer.valueOf(p_serialize_1_.getFrameIndex(i)));
jsonobject1.addProperty("time",(Number)Integer.valueOf(p_serialize_1_.getFrameTimeSingle(i)));
jsonarray.add(jsonobject1);
}
else
{
jsonarray.add(new JsonPrimitive(Integer.valueOf(p_serialize_1_.getFrameIndex(i))));
}
}
jsonobject.add("frames",jsonarray);
}
return jsonobject;
}
@H_502_5@
@H_502_5@
项目:mapBox-events-android
文件:RerouteDataSerializer.java
@H_502_5@
private void serializeNewData(NavigationRerouteData src,JsonSerializationContext context,JsonObject rerouteData) {
JsonObject newData = context.serialize(src.getNavigationNewData()).getAsJsonObject();
for (Map.Entry<String,JsonElement> e : newData.entrySet()) {
rerouteData.add(e.getKey(),e.getValue());
}
}
@H_502_5@
@H_502_5@
项目:BaseClient
文件:ServerStatusResponse.java
@H_502_5@
public JsonElement serialize(ServerStatusResponse.minecraftProtocolVersionIdentifier p_serialize_1_,JsonSerializationContext p_serialize_3_)
{
JsonObject jsonobject = new JsonObject();
jsonobject.addProperty("name",p_serialize_1_.getName());
jsonobject.addProperty("protocol",(Number)Integer.valueOf(p_serialize_1_.getProtocol()));
return jsonobject;
}
@H_502_5@
@H_502_5@
项目:buckaroo
文件:RemoteCookBookSerializer.java
@H_502_5@
@Override
public JsonElement serialize(final RemoteCookbook cookBook,final Type type,final JsonSerializationContext context) {
Preconditions.checkNotNull(cookBook);
Preconditions.checkNotNull(type);
Preconditions.checkNotNull(context);
final JsonObject jsonObject = new JsonObject();
jsonObject.add("name",context.serialize(cookBook.name));
jsonObject.add("url",context.serialize(cookBook.url));
return jsonObject;
}
@H_502_5@
@H_502_5@
项目:mapBox-events-android
文件:LocationDataSerializer.java
@H_502_5@
@Override
public JsonElement serialize(NavigationLocationData src,JsonSerializationContext context) {
JsonObject locationData = new JsonObject();
JsonArray locationsBefore = context.serialize(src.getLocationsBefore()).getAsJsonArray();
JsonArray locationsAfter = context.serialize(src.getLocationsAfter()).getAsJsonArray();
locationData.add(LOCATIONS_BEFORE,locationsBefore);
locationData.add(LOCATIONS_AFTER,locationsAfter);
return locationData;
}
@H_502_5@
@H_502_5@
项目:n5
文件:CompressionAdapter.java
@H_502_5@
@Override
public JsonElement serialize(Compression compression,JsonSerializationContext context) {
final String type = compression.getType();
final Class<? extends Compression> clazz = compression.getClass();
JsonObject json = new JsonObject();
json.addProperty("type",type);
final HashMap<String,Class<?>> parameterTypes = compressionParameters.get(type);
try {
for (final Entry<String,Class<?>> parameterType : parameterTypes.entrySet()) {
final String name = parameterType.getKey();
Field field = clazz.getDeclaredField(name);
final boolean isAccessible = field.isAccessible();
field.setAccessible(true);
final Object value = field.get(compression);
field.setAccessible(isAccessible);
json.add(parameterType.getKey(),context.serialize(value));
}
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | illegalaccessexception e) {
e.printstacktrace(System.err);
return null;
}
return json;
}
@H_502_5@
@H_502_5@
项目:jSpace
文件:TemplateSerializer.java
@H_502_5@
@Override
public JsonElement serialize(Template src,JsonSerializationContext context) {
JsonArray toReturn = new JsonArray();
jSonUtils utils = jSonUtils.getInstance();
for (TemplateField f : src) {
toReturn.add(utils.jsonFromTeplate(f,context));
}
return toReturn;
}
@H_502_5@
@H_502_5@
项目:hypertrack-live-android
文件:LocationSerializer.java
@H_502_5@
public JsonElement serialize(Location t,JsonSerializationContext jsc) {
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("mProvider",t.getProvider());
jsonObject.addProperty("mAccuracy",t.getAccuracy());
jsonObject.addProperty("mLatitude",t.getLatitude());
jsonObject.addProperty("mLongitude",t.getLongitude());
jsonObject.addProperty("mTime",t.getTime());
jsonObject.addProperty("mSpeed",t.getSpeed());
jsonObject.addProperty("mbearing",t.getbearing());
return jsonObject;
}
@H_502_5@
@H_502_5@
项目:Backmemed
文件:PlayerProfileCache.java
@H_502_5@
public JsonElement serialize(PlayerProfileCache.ProfileEntry p_serialize_1_,p_serialize_1_.getGameProfile().getName());
UUID uuid = p_serialize_1_.getGameProfile().getId();
jsonobject.addProperty("uuid",uuid == null ? "" : uuid.toString());
jsonobject.addProperty("expiresOn",PlayerProfileCache.DATE_FORMAT.format(p_serialize_1_.getExpirationDate()));
return jsonobject;
}
@H_502_5@
@H_502_5@
项目:nifi-swagger-client
文件:JSON.java
@H_502_5@
/**
* Serialize
*
* @param src Date
* @param typeOfSrc Type
* @param context Json Serialization Context
* @return Json Element
*/
@Override
public JsonElement serialize(Date src,JsonSerializationContext context) {
if (src == null) {
return JsonNull.INSTANCE;
} else {
return new JsonPrimitive(apiclient.formatDatetime(src));
}
}
@H_502_5@
@H_502_5@
项目:CustomWorldGen
文件:ServerStatusResponse.java
@H_502_5@
public JsonElement serialize(ServerStatusResponse p_serialize_1_,p_serialize_3_.serialize(p_serialize_1_.getServerDescription()));
}
if (p_serialize_1_.getPlayers() != null)
{
jsonobject.add("players",p_serialize_3_.serialize(p_serialize_1_.getPlayers()));
}
if (p_serialize_1_.getVersion() != null)
{
jsonobject.add("version",p_serialize_3_.serialize(p_serialize_1_.getVersion()));
}
if (p_serialize_1_.getFavicon() != null)
{
jsonobject.addProperty("favicon",p_serialize_1_.getFavicon());
}
net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.enhanceStatusQuery(jsonobject);
return jsonobject;
}
@H_502_5@
@H_502_5@
项目:Backmemed
文件:AnimationMetadataSectionSerializer.java
@H_502_5@
public JsonElement serialize(AnimationMetadataSection p_serialize_1_,jsonarray);
}
return jsonobject;
}
@H_502_5@
@H_502_5@
项目:skywalking-mock-collector
文件:ValidateDataSerializer.java
@H_502_5@
@Override
public JsonElement serialize(ValidateData src,JsonSerializationContext context) {
Gson gson = new GsonBuilder().registerTypeAdapter(RegistryItem.class,new RegistryItemSerializer())
.registerTypeAdapter(SegmentItems.class,new SegmentItemsSerializer()).create();
JsonObject jsonObject = new JsonObject();
jsonObject.add("registryItems",gson.toJsonTree(src.getRegistryItem()));
jsonObject.add("segmentItems",gson.toJsonTree(src.getSegmentItem()));
return jsonObject;
}
@H_502_5@
@H_502_5@
项目:PI-Web-API-Client-Java-Android
文件:JSON.java
@H_502_5@
/**
* Serialize
*
* @param src Date
* @param typeOfSrc Type
* @param context Json Serialization Context
* @return Json Element
*/
@Override
public JsonElement serialize(Date src,JsonSerializationContext context) {
if (src == null) {
return JsonNull.INSTANCE;
} else {
return new JsonPrimitive(apiclient.formatDatetime(src));
}
}
@H_502_5@
@H_502_5@
项目:mapBox-events-android
文件:FeedbackEventSerializer.java
@H_502_5@
private void serializeFeedbackEventData(NavigationFeedbackEvent src,JsonObject FeedbackEvent) {
JsonObject FeedbackEventData = context.serialize(src.getFeedbackEventData()).getAsJsonObject();
for (Map.Entry<String,JsonElement> e : FeedbackEventData.entrySet()) {
FeedbackEvent.add(e.getKey(),e.getValue());
}
}
@H_502_5@
@H_502_5@
项目:mazes_and_minotaurs
文件:CharacterSerializer.java
@H_502_5@
@Override
public JsonElement serialize(PlayerCharacter src,JsonSerializationContext context) {
BaseClass characterClass = src.getCharClass();
characterClass.setCharacter(null);
Type equipListType = new Typetoken<ArrayList<Equipment>>() {
}.getType();
Type moneyMapType = new Typetoken<HashMap<Money,Integer>>() {
}.getType();
JsonObject rootObject = new JsonObject();
rootObject.add("mscores",context.serialize(src.getscores()));
rootObject.add("mCharClass",context.serialize(src.getCharClass(),BaseClass.class));
rootObject.add("mGender",context.serialize(src.getGender()));
rootObject.add("mMoney",context.serialize(src.getMoney(),moneyMapType));
rootObject.add("mAge",context.serialize(src.getAge()));
rootObject.add("mName",context.serialize(src.getName()));
System.out.println(getGson().toJsonTree(src.getInventory(),equipListType));
rootObject.add("mInventory",getGson().toJsonTree(src.getInventory(),equipListType));
rootObject.add("mCurrentWeapon",context.serialize(src.getCurrentWeapon()));
rootObject.add("mHelmet",context.serialize(src.getHelmet()));
rootObject.add("mBreastplate",context.serialize(src.getBreastplate()));
rootObject.add("mShield",context.serialize(src.getShield()));
rootObject.add("mPatron",context.serialize(src.getPatron()));
JsonElement classjson = context.serialize(characterClass);
classjson.getAsJsonObject().remove("mResId");
rootObject.add("mCharClass",classjson);
characterClass.setCharacter(src);
return rootObject;
}
@H_502_5@
@H_502_5@
项目:Backmemed
文件:EntityHasscore.java
@H_502_5@
public void serialize(JsonObject json,EntityHasscore value,JsonSerializationContext context)
{
JsonObject jsonobject = new JsonObject();
for (Entry<String,RandomValueRange> entry : value.scores.entrySet())
{
jsonobject.add((String)entry.getKey(),context.serialize(entry.getValue()));
}
json.add("scores",jsonobject);
json.add("entity",context.serialize(value.target));
}
@H_502_5@
@H_502_5@
项目:IPE-LWM2M
文件:SecuritySerializer.java
@H_502_5@
@Override
public JsonElement serialize(SecurityInfo src,JsonSerializationContext context) {
JsonObject element = new JsonObject();
element.addProperty("endpoint",src.getEndpoint());
if (src.getIdentity() != null) {
JsonObject psk = new JsonObject();
psk.addProperty("identity",src.getIdentity());
psk.addProperty("key",Hex.encodeHexString(src.getPreSharedKey()));
element.add("psk",psk);
}
if (src.getRawPublicKey() != null) {
JsonObject rpk = new JsonObject();
PublicKey rawPublicKey = src.getRawPublicKey();
if (rawPublicKey instanceof EcpublicKey) {
EcpublicKey ecpublicKey = (EcpublicKey) rawPublicKey;
// Get x coordinate
byte[] x = ecpublicKey.getW().getAffineX().toByteArray();
if (x[0] == 0)
x = Arrays.copyOfRange(x,1,x.length);
rpk.addProperty("x",Hex.encodeHexString(x));
// Get Y coordinate
byte[] y = ecpublicKey.getW().getAffineY().toByteArray();
if (y[0] == 0)
y = Arrays.copyOfRange(y,y.length);
rpk.addProperty("y",Hex.encodeHexString(y));
// Get Curves params
rpk.addProperty("params",ecpublicKey.getParams().toString());
} else {
throw new JsonParseException("Unsupported Public Key Format (only EcpublicKey supported).");
}
element.add("rpk",rpk);
}
return element;
}
@H_502_5@
@H_502_5@
项目:mapBox-events-android
文件:RerouteDataSerializer.java
@H_502_5@
@Override
public JsonElement serialize(NavigationRerouteData src,JsonSerializationContext context) {
JsonObject rerouteData = new JsonObject();
rerouteData.addProperty(SECOND_SINCE_LAST_REROUTE,src.getSecondsSinceLastReroute());
serializeNewData(src,context,rerouteData);
return rerouteData;
}
@H_502_5@
@H_502_5@
项目:mapBox-events-android
文件:FeedbackDataSerializer.java
@H_502_5@
@Override
public JsonElement serialize(FeedbackData src,JsonSerializationContext context) {
JsonObject FeedbackData = new JsonObject();
FeedbackData.addProperty(FeedBACK_ID,src.getFeedbackId());
FeedbackData.addProperty(SCREENSHOT,src.getScreenshot());
return FeedbackData;
}
@H_502_5@
@H_502_5@
项目:BaseClient
文件:IChatComponent.java
@H_502_5@
private void serializeChatStyle(ChatStyle style,JsonObject object,JsonSerializationContext ctx)
{
JsonElement jsonelement = ctx.serialize(style);
if (jsonelement.isJsonObject())
{
JsonObject jsonobject = (JsonObject)jsonelement;
for (Entry<String,JsonElement> entry : jsonobject.entrySet())
{
object.add((String)entry.getKey(),(JsonElement)entry.getValue());
}
}
}
@H_502_5@
@H_502_5@
项目:Decompiledminecraft
文件:ServerStatusResponse.java
@H_502_5@
public JsonElement serialize(ServerStatusResponse.minecraftProtocolVersionIdentifier p_serialize_1_,(Number)Integer.valueOf(p_serialize_1_.getProtocol()));
return jsonobject;
}
@H_502_5@
@H_502_5@
项目:mapBox-events-android
文件:VoiceDataSerializer.java
@H_502_5@
@Override
public JsonElement serialize(NavigationVoiceData src,JsonSerializationContext context) {
JsonObject voiceData = new JsonObject();
voiceData.addProperty(VOICE_INSTRUCTION,src.getVoiceInstruction());
voiceData.addProperty(VOICE_INSTRUCTION_TIMESTAMP,src.getVoiceInstructionTimestamp());
return voiceData;
}
@H_502_5@
@H_502_5@
项目:Decompiledminecraft
文件:PlayerProfileCache.java
@H_502_5@
public JsonElement serialize(PlayerProfileCache.ProfileEntry p_serialize_1_,PlayerProfileCache.dateFormat.format(p_serialize_1_.getExpirationDate()));
return jsonobject;
}
@H_502_5@
@H_502_5@
项目:mapBox-events-android
文件:ArriveEventSerializer.java
@H_502_5@
private void serializeMetadata(NavigationArriveEvent src,JsonObject arriveEvent) {
JsonObject Metadata = context.serialize(src.getMetadata()).getAsJsonObject();
for (Map.Entry<String,JsonElement> e : Metadata.entrySet()) {
arriveEvent.add(e.getKey(),e.getValue());
}
}
@H_502_5@
@H_502_5@
项目:CustomWorldGen
文件:ITextComponent.java
@H_502_5@
private void serializeChatStyle(Style style,(JsonElement)entry.getValue());
}
}
}
@H_502_5@
@H_502_5@
项目:opentest
文件:ScriptObjectMirrorSerializer.java
@H_502_5@
@Override
public JsonElement serialize(ScriptObjectMirror src,java.lang.reflect.Type typeOfSrc,JsonSerializationContext context) {
Gson gson = new Gson();
if (src.isArray()) {
return gson.toJsonTree(src.values());
} else {
return gson.toJsonTree(src);
}
}
@H_502_5@
@H_502_5@
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。