changed namespace to com.massivecraft
This commit is contained in:
parent
60603892c6
commit
8aefae5679
@ -1,4 +1,4 @@
|
|||||||
package org.mcteam.factions;
|
package com.massivecraft.factions;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
@ -11,14 +11,15 @@ import java.util.Map.Entry;
|
|||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.mcteam.factions.gson.JsonArray;
|
|
||||||
import org.mcteam.factions.gson.JsonElement;
|
import com.massivecraft.factions.gson.JsonArray;
|
||||||
import org.mcteam.factions.gson.JsonObject;
|
import com.massivecraft.factions.gson.JsonElement;
|
||||||
import org.mcteam.factions.gson.JsonParser;
|
import com.massivecraft.factions.gson.JsonObject;
|
||||||
import org.mcteam.factions.gson.reflect.TypeToken;
|
import com.massivecraft.factions.gson.JsonParser;
|
||||||
import org.mcteam.factions.util.AsciiCompass;
|
import com.massivecraft.factions.gson.reflect.TypeToken;
|
||||||
import org.mcteam.factions.util.DiscUtil;
|
import com.massivecraft.factions.util.AsciiCompass;
|
||||||
import org.mcteam.factions.util.TextUtil;
|
import com.massivecraft.factions.util.DiscUtil;
|
||||||
|
import com.massivecraft.factions.util.TextUtil;
|
||||||
|
|
||||||
|
|
||||||
public class Board {
|
public class Board {
|
@ -1,10 +1,11 @@
|
|||||||
package org.mcteam.factions;
|
package com.massivecraft.factions;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.entity.CreatureType;
|
import org.bukkit.entity.CreatureType;
|
||||||
import org.mcteam.factions.util.DiscUtil;
|
|
||||||
|
import com.massivecraft.factions.util.DiscUtil;
|
||||||
|
|
||||||
|
|
||||||
public class Conf {
|
public class Conf {
|
@ -1,11 +1,12 @@
|
|||||||
package org.mcteam.factions;
|
package com.massivecraft.factions;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.mcteam.factions.util.MiscUtil;
|
|
||||||
|
import com.massivecraft.factions.util.MiscUtil;
|
||||||
|
|
||||||
public class FLocation {
|
public class FLocation {
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package org.mcteam.factions;
|
package com.massivecraft.factions;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
@ -8,10 +8,11 @@ import java.util.Map.Entry;
|
|||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.mcteam.factions.gson.reflect.TypeToken;
|
|
||||||
import org.mcteam.factions.struct.Relation;
|
import com.massivecraft.factions.gson.reflect.TypeToken;
|
||||||
import org.mcteam.factions.struct.Role;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
import org.mcteam.factions.util.DiscUtil;
|
import com.massivecraft.factions.struct.Role;
|
||||||
|
import com.massivecraft.factions.util.DiscUtil;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
@ -1,4 +1,4 @@
|
|||||||
package org.mcteam.factions;
|
package com.massivecraft.factions;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
@ -9,10 +9,11 @@ import java.util.logging.Level;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.mcteam.factions.gson.reflect.TypeToken;
|
|
||||||
import org.mcteam.factions.struct.Relation;
|
import com.massivecraft.factions.gson.reflect.TypeToken;
|
||||||
import org.mcteam.factions.struct.Role;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
import org.mcteam.factions.util.*;
|
import com.massivecraft.factions.struct.Role;
|
||||||
|
import com.massivecraft.factions.util.*;
|
||||||
|
|
||||||
|
|
||||||
public class Faction {
|
public class Faction {
|
@ -1,4 +1,4 @@
|
|||||||
package org.mcteam.factions;
|
package com.massivecraft.factions;
|
||||||
|
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -19,14 +19,14 @@ import org.bukkit.event.player.PlayerChatEvent;
|
|||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.mcteam.factions.commands.*;
|
|
||||||
import org.mcteam.factions.gson.Gson;
|
|
||||||
import org.mcteam.factions.gson.GsonBuilder;
|
|
||||||
import org.mcteam.factions.listeners.FactionsBlockListener;
|
|
||||||
import org.mcteam.factions.listeners.FactionsEntityListener;
|
|
||||||
import org.mcteam.factions.listeners.FactionsPlayerListener;
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.massivecraft.factions.commands.*;
|
||||||
|
import com.massivecraft.factions.gson.Gson;
|
||||||
|
import com.massivecraft.factions.gson.GsonBuilder;
|
||||||
|
import com.massivecraft.factions.listeners.FactionsBlockListener;
|
||||||
|
import com.massivecraft.factions.listeners.FactionsEntityListener;
|
||||||
|
import com.massivecraft.factions.listeners.FactionsPlayerListener;
|
||||||
import com.nijiko.permissions.PermissionHandler;
|
import com.nijiko.permissions.PermissionHandler;
|
||||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||||
|
|
@ -1,17 +1,18 @@
|
|||||||
package org.mcteam.factions;
|
package com.massivecraft.factions;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.mcteam.factions.gson.JsonDeserializationContext;
|
|
||||||
import org.mcteam.factions.gson.JsonDeserializer;
|
import com.massivecraft.factions.gson.JsonDeserializationContext;
|
||||||
import org.mcteam.factions.gson.JsonElement;
|
import com.massivecraft.factions.gson.JsonDeserializer;
|
||||||
import org.mcteam.factions.gson.JsonObject;
|
import com.massivecraft.factions.gson.JsonElement;
|
||||||
import org.mcteam.factions.gson.JsonParseException;
|
import com.massivecraft.factions.gson.JsonObject;
|
||||||
import org.mcteam.factions.gson.JsonSerializationContext;
|
import com.massivecraft.factions.gson.JsonParseException;
|
||||||
import org.mcteam.factions.gson.JsonSerializer;
|
import com.massivecraft.factions.gson.JsonSerializationContext;
|
||||||
|
import com.massivecraft.factions.gson.JsonSerializer;
|
||||||
|
|
||||||
|
|
||||||
public class MyLocationTypeAdapter implements JsonDeserializer<Location>, JsonSerializer<Location> {
|
public class MyLocationTypeAdapter implements JsonDeserializer<Location>, JsonSerializer<Location> {
|
@ -1,4 +1,4 @@
|
|||||||
package org.mcteam.factions;
|
package com.massivecraft.factions;
|
||||||
|
|
||||||
public class SaveTask implements Runnable {
|
public class SaveTask implements Runnable {
|
||||||
|
|
@ -1,16 +1,17 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.mcteam.factions.Conf;
|
|
||||||
import org.mcteam.factions.FPlayer;
|
import com.massivecraft.factions.Conf;
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import org.mcteam.factions.Factions;
|
import com.massivecraft.factions.Faction;
|
||||||
import org.mcteam.factions.struct.Role;
|
import com.massivecraft.factions.Factions;
|
||||||
import org.mcteam.factions.util.TextUtil;
|
import com.massivecraft.factions.struct.Role;
|
||||||
|
import com.massivecraft.factions.util.TextUtil;
|
||||||
|
|
||||||
|
|
||||||
public class FBaseCommand {
|
public class FBaseCommand {
|
@ -1,9 +1,9 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.mcteam.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import org.mcteam.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import org.mcteam.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
|
|
||||||
public class FCommandAdmin extends FBaseCommand {
|
public class FCommandAdmin extends FBaseCommand {
|
||||||
|
|
@ -1,9 +1,9 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.mcteam.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import org.mcteam.factions.FLocation;
|
import com.massivecraft.factions.FLocation;
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import org.mcteam.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
|
|
||||||
public class FCommandAutoClaim extends FBaseCommand {
|
public class FCommandAutoClaim extends FBaseCommand {
|
||||||
|
|
@ -1,10 +1,11 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.mcteam.factions.Board;
|
|
||||||
import org.mcteam.factions.FLocation;
|
import com.massivecraft.factions.Board;
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.FLocation;
|
||||||
import org.mcteam.factions.Factions;
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.Factions;
|
||||||
|
|
||||||
public class FCommandAutoSafeclaim extends FBaseCommand {
|
public class FCommandAutoSafeclaim extends FBaseCommand {
|
||||||
|
|
@ -1,10 +1,11 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.mcteam.factions.Board;
|
|
||||||
import org.mcteam.factions.FLocation;
|
import com.massivecraft.factions.Board;
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.FLocation;
|
||||||
import org.mcteam.factions.Factions;
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.Factions;
|
||||||
|
|
||||||
public class FCommandAutoWarclaim extends FBaseCommand {
|
public class FCommandAutoWarclaim extends FBaseCommand {
|
||||||
|
|
@ -1,8 +1,9 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.mcteam.factions.Conf;
|
|
||||||
import org.mcteam.factions.Factions;
|
import com.massivecraft.factions.Conf;
|
||||||
|
import com.massivecraft.factions.Factions;
|
||||||
|
|
||||||
|
|
||||||
public class FCommandBypass extends FBaseCommand {
|
public class FCommandBypass extends FBaseCommand {
|
@ -1,4 +1,4 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
public class FCommandChat extends FBaseCommand {
|
public class FCommandChat extends FBaseCommand {
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
public class FCommandClaim extends FBaseCommand {
|
public class FCommandClaim extends FBaseCommand {
|
||||||
|
|
@ -1,13 +1,14 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.mcteam.factions.Conf;
|
|
||||||
import org.mcteam.factions.FPlayer;
|
import com.massivecraft.factions.Conf;
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import org.mcteam.factions.Factions;
|
import com.massivecraft.factions.Faction;
|
||||||
import org.mcteam.factions.struct.Role;
|
import com.massivecraft.factions.Factions;
|
||||||
|
import com.massivecraft.factions.struct.Role;
|
||||||
|
|
||||||
|
|
||||||
public class FCommandCreate extends FBaseCommand {
|
public class FCommandCreate extends FBaseCommand {
|
@ -1,9 +1,9 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.mcteam.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import org.mcteam.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import org.mcteam.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
|
|
||||||
public class FCommandDeinvite extends FBaseCommand {
|
public class FCommandDeinvite extends FBaseCommand {
|
||||||
|
|
@ -1,9 +1,9 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.mcteam.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import org.mcteam.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import org.mcteam.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
import org.mcteam.factions.util.TextUtil;
|
import com.massivecraft.factions.util.TextUtil;
|
||||||
|
|
||||||
public class FCommandDescription extends FBaseCommand {
|
public class FCommandDescription extends FBaseCommand {
|
||||||
|
|
@ -1,8 +1,9 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.mcteam.factions.Faction;
|
|
||||||
import org.mcteam.factions.Factions;
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.Factions;
|
||||||
|
|
||||||
public class FCommandDisband extends FBaseCommand {
|
public class FCommandDisband extends FBaseCommand {
|
||||||
|
|
@ -1,10 +1,11 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.mcteam.factions.Conf;
|
|
||||||
import org.mcteam.factions.util.TextUtil;
|
import com.massivecraft.factions.Conf;
|
||||||
|
import com.massivecraft.factions.util.TextUtil;
|
||||||
|
|
||||||
|
|
||||||
public class FCommandHelp extends FBaseCommand {
|
public class FCommandHelp extends FBaseCommand {
|
@ -1,15 +1,16 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.mcteam.factions.Board;
|
|
||||||
import org.mcteam.factions.Conf;
|
import com.massivecraft.factions.Board;
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.Conf;
|
||||||
import org.mcteam.factions.FLocation;
|
import com.massivecraft.factions.FLocation;
|
||||||
import org.mcteam.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import org.mcteam.factions.struct.Relation;
|
import com.massivecraft.factions.Faction;
|
||||||
import org.mcteam.factions.struct.Role;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
|
import com.massivecraft.factions.struct.Role;
|
||||||
|
|
||||||
public class FCommandHome extends FBaseCommand {
|
public class FCommandHome extends FBaseCommand {
|
||||||
|
|
||||||
@ -48,7 +49,7 @@ public class FCommandHome extends FBaseCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Conf.homesTeleportAllowedFromDifferentWorld && player.getWorld().getId() != myFaction.getHome().getWorld().getId()) {
|
if (!Conf.homesTeleportAllowedFromDifferentWorld && player.getWorld().getUID() != myFaction.getHome().getWorld().getUID()) {
|
||||||
me.sendMessage("You cannot teleport to your faction home while in a different world.");
|
me.sendMessage("You cannot teleport to your faction home while in a different world.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
@ -1,9 +1,9 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.mcteam.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import org.mcteam.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import org.mcteam.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
|
|
||||||
public class FCommandInvite extends FBaseCommand {
|
public class FCommandInvite extends FBaseCommand {
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.mcteam.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
|
|
||||||
public class FCommandJoin extends FBaseCommand {
|
public class FCommandJoin extends FBaseCommand {
|
||||||
|
|
@ -1,9 +1,9 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.mcteam.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import org.mcteam.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import org.mcteam.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
|
|
||||||
public class FCommandKick extends FBaseCommand {
|
public class FCommandKick extends FBaseCommand {
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
@ -1,13 +1,14 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.mcteam.factions.Conf;
|
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.Conf;
|
||||||
import org.mcteam.factions.util.TextUtil;
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.util.TextUtil;
|
||||||
|
|
||||||
|
|
||||||
public class FCommandList extends FBaseCommand {
|
public class FCommandList extends FBaseCommand {
|
@ -1,7 +1,8 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.mcteam.factions.Factions;
|
|
||||||
|
import com.massivecraft.factions.Factions;
|
||||||
|
|
||||||
public class FCommandLock extends FBaseCommand {
|
public class FCommandLock extends FBaseCommand {
|
||||||
|
|
@ -1,8 +1,9 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.mcteam.factions.Board;
|
|
||||||
import org.mcteam.factions.FLocation;
|
import com.massivecraft.factions.Board;
|
||||||
|
import com.massivecraft.factions.FLocation;
|
||||||
|
|
||||||
|
|
||||||
public class FCommandMap extends FBaseCommand {
|
public class FCommandMap extends FBaseCommand {
|
@ -1,9 +1,9 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.mcteam.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import org.mcteam.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import org.mcteam.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
|
|
||||||
public class FCommandMod extends FBaseCommand {
|
public class FCommandMod extends FBaseCommand {
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.mcteam.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import org.mcteam.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
|
|
||||||
public class FCommandOpen extends FBaseCommand {
|
public class FCommandOpen extends FBaseCommand {
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.mcteam.factions.struct.Relation;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
|
|
||||||
public class FCommandRelationAlly extends FRelationCommand {
|
public class FCommandRelationAlly extends FRelationCommand {
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.mcteam.factions.struct.Relation;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
|
|
||||||
public class FCommandRelationEnemy extends FRelationCommand {
|
public class FCommandRelationEnemy extends FRelationCommand {
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.mcteam.factions.struct.Relation;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
|
|
||||||
public class FCommandRelationNeutral extends FRelationCommand {
|
public class FCommandRelationNeutral extends FRelationCommand {
|
||||||
|
|
@ -1,11 +1,12 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.mcteam.factions.Board;
|
|
||||||
import org.mcteam.factions.Conf;
|
import com.massivecraft.factions.Board;
|
||||||
import org.mcteam.factions.FPlayer;
|
import com.massivecraft.factions.Conf;
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import org.mcteam.factions.Factions;
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.Factions;
|
||||||
|
|
||||||
public class FCommandReload extends FBaseCommand {
|
public class FCommandReload extends FBaseCommand {
|
||||||
|
|
@ -1,10 +1,11 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.mcteam.factions.Board;
|
|
||||||
import org.mcteam.factions.FLocation;
|
import com.massivecraft.factions.Board;
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.FLocation;
|
||||||
import org.mcteam.factions.Factions;
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.Factions;
|
||||||
|
|
||||||
public class FCommandSafeclaim extends FBaseCommand {
|
public class FCommandSafeclaim extends FBaseCommand {
|
||||||
|
|
@ -1,9 +1,10 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.mcteam.factions.Board;
|
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.Board;
|
||||||
import org.mcteam.factions.Factions;
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.Factions;
|
||||||
|
|
||||||
public class FCommandSafeunclaimall extends FBaseCommand {
|
public class FCommandSafeunclaimall extends FBaseCommand {
|
||||||
|
|
@ -1,7 +1,8 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.mcteam.factions.Factions;
|
|
||||||
|
import com.massivecraft.factions.Factions;
|
||||||
|
|
||||||
public class FCommandSaveAll extends FBaseCommand {
|
public class FCommandSaveAll extends FBaseCommand {
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.mcteam.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import org.mcteam.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
|
|
||||||
public class FCommandSethome extends FBaseCommand {
|
public class FCommandSethome extends FBaseCommand {
|
||||||
|
|
@ -1,14 +1,15 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.mcteam.factions.Conf;
|
|
||||||
import org.mcteam.factions.FPlayer;
|
import com.massivecraft.factions.Conf;
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import org.mcteam.factions.struct.Role;
|
import com.massivecraft.factions.Faction;
|
||||||
import org.mcteam.factions.util.TextUtil;
|
import com.massivecraft.factions.struct.Role;
|
||||||
|
import com.massivecraft.factions.util.TextUtil;
|
||||||
|
|
||||||
|
|
||||||
public class FCommandShow extends FBaseCommand {
|
public class FCommandShow extends FBaseCommand {
|
@ -1,11 +1,11 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.mcteam.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import org.mcteam.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
import org.mcteam.factions.util.TextUtil;
|
import com.massivecraft.factions.util.TextUtil;
|
||||||
|
|
||||||
|
|
||||||
public class FCommandTag extends FBaseCommand {
|
public class FCommandTag extends FBaseCommand {
|
@ -1,9 +1,9 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.mcteam.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import org.mcteam.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import org.mcteam.factions.util.TextUtil;
|
import com.massivecraft.factions.util.TextUtil;
|
||||||
|
|
||||||
public class FCommandTitle extends FBaseCommand {
|
public class FCommandTitle extends FBaseCommand {
|
||||||
|
|
@ -1,11 +1,11 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.mcteam.factions.Board;
|
import com.massivecraft.factions.Board;
|
||||||
import org.mcteam.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import org.mcteam.factions.FLocation;
|
import com.massivecraft.factions.FLocation;
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import org.mcteam.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
import org.mcteam.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
|
|
||||||
public class FCommandUnclaim extends FBaseCommand {
|
public class FCommandUnclaim extends FBaseCommand {
|
||||||
|
|
@ -1,9 +1,9 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.mcteam.factions.Board;
|
import com.massivecraft.factions.Board;
|
||||||
import org.mcteam.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import org.mcteam.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
|
|
||||||
public class FCommandUnclaimall extends FBaseCommand {
|
public class FCommandUnclaimall extends FBaseCommand {
|
||||||
|
|
@ -1,7 +1,8 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.mcteam.factions.Factions;
|
|
||||||
|
import com.massivecraft.factions.Factions;
|
||||||
|
|
||||||
|
|
||||||
public class FCommandVersion extends FBaseCommand {
|
public class FCommandVersion extends FBaseCommand {
|
@ -1,10 +1,11 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.mcteam.factions.Board;
|
|
||||||
import org.mcteam.factions.FLocation;
|
import com.massivecraft.factions.Board;
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.FLocation;
|
||||||
import org.mcteam.factions.Factions;
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.Factions;
|
||||||
|
|
||||||
public class FCommandWarclaim extends FBaseCommand {
|
public class FCommandWarclaim extends FBaseCommand {
|
||||||
|
|
@ -1,9 +1,10 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.mcteam.factions.Board;
|
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.Board;
|
||||||
import org.mcteam.factions.Factions;
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.Factions;
|
||||||
|
|
||||||
public class FCommandWarunclaimall extends FBaseCommand {
|
public class FCommandWarunclaimall extends FBaseCommand {
|
||||||
|
|
@ -1,8 +1,9 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.mcteam.factions.Conf;
|
|
||||||
import org.mcteam.factions.Factions;
|
import com.massivecraft.factions.Conf;
|
||||||
|
import com.massivecraft.factions.Factions;
|
||||||
|
|
||||||
public class FCommandWorldNoClaim extends FBaseCommand {
|
public class FCommandWorldNoClaim extends FBaseCommand {
|
||||||
|
|
@ -1,8 +1,9 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.mcteam.factions.Conf;
|
|
||||||
import org.mcteam.factions.Factions;
|
import com.massivecraft.factions.Conf;
|
||||||
|
import com.massivecraft.factions.Factions;
|
||||||
|
|
||||||
public class FCommandWorldNoPowerLoss extends FBaseCommand {
|
public class FCommandWorldNoPowerLoss extends FBaseCommand {
|
||||||
|
|
@ -1,11 +1,12 @@
|
|||||||
package org.mcteam.factions.commands;
|
package com.massivecraft.factions.commands;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.mcteam.factions.Conf;
|
|
||||||
import org.mcteam.factions.Faction;
|
import com.massivecraft.factions.Conf;
|
||||||
import org.mcteam.factions.Factions;
|
import com.massivecraft.factions.Faction;
|
||||||
import org.mcteam.factions.struct.Relation;
|
import com.massivecraft.factions.Factions;
|
||||||
import org.mcteam.factions.struct.Role;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
|
import com.massivecraft.factions.struct.Role;
|
||||||
|
|
||||||
|
|
||||||
public class FRelationCommand extends FBaseCommand {
|
public class FRelationCommand extends FBaseCommand {
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Strategy for excluding anonymous and local classes.
|
* Strategy for excluding anonymous and local classes.
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines generic cache interface.
|
* Defines generic cache interface.
|
@ -14,9 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import org.mcteam.factions.gson.internal.$Gson$Preconditions;
|
import com.massivecraft.factions.gson.internal.$Gson$Preconditions;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exception class to indicate a circular reference error.
|
* Exception class to indicate a circular reference error.
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
@ -14,9 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.gson.internal.$Gson$Types;
|
||||||
|
|
||||||
import org.mcteam.factions.gson.internal.$Gson$Types;
|
|
||||||
import java.lang.reflect.ParameterizedType;
|
import java.lang.reflect.ParameterizedType;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
@ -14,9 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import org.mcteam.factions.gson.internal.$Gson$Preconditions;
|
import com.massivecraft.factions.gson.internal.$Gson$Preconditions;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
@ -14,9 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import org.mcteam.factions.gson.internal.$Gson$Preconditions;
|
import com.massivecraft.factions.gson.internal.$Gson$Preconditions;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A strategy (or policy) definition that is used to decide whether or not a field or top-level
|
* A strategy (or policy) definition that is used to decide whether or not a field or top-level
|
@ -14,9 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import org.mcteam.factions.gson.annotations.Expose;
|
import com.massivecraft.factions.gson.annotations.Expose;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Excludes fields that do not have the {@link Expose} annotation
|
* Excludes fields that do not have the {@link Expose} annotation
|
@ -14,9 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import org.mcteam.factions.gson.annotations.Expose;
|
import com.massivecraft.factions.gson.annotations.Expose;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Excludes fields that do not have the {@link Expose} annotation
|
* Excludes fields that do not have the {@link Expose} annotation
|
@ -14,10 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import org.mcteam.factions.gson.internal.$Gson$Preconditions;
|
import com.massivecraft.factions.gson.internal.$Gson$Preconditions;
|
||||||
import org.mcteam.factions.gson.internal.$Gson$Types;
|
import com.massivecraft.factions.gson.internal.$Gson$Types;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
@ -38,7 +38,7 @@ import java.util.Collections;
|
|||||||
*/
|
*/
|
||||||
public final class FieldAttributes {
|
public final class FieldAttributes {
|
||||||
private static final String MAX_CACHE_PROPERTY_NAME =
|
private static final String MAX_CACHE_PROPERTY_NAME =
|
||||||
"org.mcteam.factions.gson.annotation_cache_size_hint";
|
"com.google.gson.annotation_cache_size_hint";
|
||||||
|
|
||||||
private static final Cache<Pair<Class<?>, String>, Collection<Annotation>> ANNOTATION_CACHE =
|
private static final Cache<Pair<Class<?>, String>, Collection<Annotation>> ANNOTATION_CACHE =
|
||||||
new LruCache<Pair<Class<?>,String>, Collection<Annotation>>(getMaxCacheSize());
|
new LruCache<Pair<Class<?>,String>, Collection<Annotation>>(getMaxCacheSize());
|
@ -14,12 +14,12 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An enumeration that defines a few standard naming conventions for JSON field names.
|
* An enumeration that defines a few standard naming conventions for JSON field names.
|
||||||
* This enumeration should be used in conjunction with {@link org.mcteam.factions.gson.GsonBuilder}
|
* This enumeration should be used in conjunction with {@link com.massivecraft.factions.gson.GsonBuilder}
|
||||||
* to configure a {@link org.mcteam.factions.gson.Gson} instance to properly translate Java field
|
* to configure a {@link com.massivecraft.factions.gson.Gson} instance to properly translate Java field
|
||||||
* names into the desired JSON field names.
|
* names into the desired JSON field names.
|
||||||
*
|
*
|
||||||
* @author Inderjeet Singh
|
* @author Inderjeet Singh
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The new mechanism for providing custom field naming in Gson. This allows the client code
|
* The new mechanism for providing custom field naming in Gson. This allows the client code
|
@ -14,9 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import org.mcteam.factions.gson.internal.$Gson$Preconditions;
|
import com.massivecraft.factions.gson.internal.$Gson$Preconditions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adapts the old FieldNamingStrategy to the new {@link FieldNamingStrategy2}
|
* Adapts the old FieldNamingStrategy to the new {@link FieldNamingStrategy2}
|
@ -14,12 +14,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.gson.stream.JsonReader;
|
||||||
|
import com.massivecraft.factions.gson.stream.JsonToken;
|
||||||
|
import com.massivecraft.factions.gson.stream.JsonWriter;
|
||||||
|
import com.massivecraft.factions.gson.stream.MalformedJsonException;
|
||||||
|
|
||||||
import org.mcteam.factions.gson.stream.JsonReader;
|
|
||||||
import org.mcteam.factions.gson.stream.JsonToken;
|
|
||||||
import org.mcteam.factions.gson.stream.JsonWriter;
|
|
||||||
import org.mcteam.factions.gson.stream.MalformedJsonException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
@ -68,7 +69,7 @@ import java.util.Map;
|
|||||||
* <p>See the <a href="https://sites.google.com/site/gson/gson-user-guide">Gson User Guide</a>
|
* <p>See the <a href="https://sites.google.com/site/gson/gson-user-guide">Gson User Guide</a>
|
||||||
* for a more complete set of examples.</p>
|
* for a more complete set of examples.</p>
|
||||||
*
|
*
|
||||||
* @see org.mcteam.factions.gson.reflect.TypeToken
|
* @see com.massivecraft.factions.gson.reflect.TypeToken
|
||||||
*
|
*
|
||||||
* @author Inderjeet Singh
|
* @author Inderjeet Singh
|
||||||
* @author Joel Leitch
|
* @author Joel Leitch
|
||||||
@ -130,10 +131,10 @@ public final class Gson {
|
|||||||
* ignores the millisecond portion of the date during serialization. You can change
|
* ignores the millisecond portion of the date during serialization. You can change
|
||||||
* this by invoking {@link GsonBuilder#setDateFormat(int)} or
|
* this by invoking {@link GsonBuilder#setDateFormat(int)} or
|
||||||
* {@link GsonBuilder#setDateFormat(String)}. </li>
|
* {@link GsonBuilder#setDateFormat(String)}. </li>
|
||||||
* <li>By default, Gson ignores the {@link org.mcteam.factions.gson.annotations.Expose} annotation.
|
* <li>By default, Gson ignores the {@link com.massivecraft.factions.gson.annotations.Expose} annotation.
|
||||||
* You can enable Gson to serialize/deserialize only those fields marked with this annotation
|
* You can enable Gson to serialize/deserialize only those fields marked with this annotation
|
||||||
* through {@link GsonBuilder#excludeFieldsWithoutExposeAnnotation()}. </li>
|
* through {@link GsonBuilder#excludeFieldsWithoutExposeAnnotation()}. </li>
|
||||||
* <li>By default, Gson ignores the {@link org.mcteam.factions.gson.annotations.Since} annotation. You
|
* <li>By default, Gson ignores the {@link com.massivecraft.factions.gson.annotations.Since} annotation. You
|
||||||
* can enable Gson to use this annotation through {@link GsonBuilder#setVersion(double)}.</li>
|
* can enable Gson to use this annotation through {@link GsonBuilder#setVersion(double)}.</li>
|
||||||
* <li>The default field naming policy for the output Json is same as in Java. So, a Java class
|
* <li>The default field naming policy for the output Json is same as in Java. So, a Java class
|
||||||
* field <code>versionNumber</code> will be output as <code>"versionNumber@quot;</code> in
|
* field <code>versionNumber</code> will be output as <code>"versionNumber@quot;</code> in
|
||||||
@ -205,7 +206,7 @@ public final class Gson {
|
|||||||
*
|
*
|
||||||
* @param src the object for which JSON representation is to be created
|
* @param src the object for which JSON representation is to be created
|
||||||
* @param typeOfSrc The specific genericized type of src. You can obtain
|
* @param typeOfSrc The specific genericized type of src. You can obtain
|
||||||
* this type by using the {@link org.mcteam.factions.gson.reflect.TypeToken} class. For example,
|
* this type by using the {@link com.massivecraft.factions.gson.reflect.TypeToken} class. For example,
|
||||||
* to get the type for {@code Collection<Foo>}, you should use:
|
* to get the type for {@code Collection<Foo>}, you should use:
|
||||||
* <pre>
|
* <pre>
|
||||||
* Type typeOfSrc = new TypeToken<Collection<Foo>>(){}.getType();
|
* Type typeOfSrc = new TypeToken<Collection<Foo>>(){}.getType();
|
||||||
@ -248,7 +249,7 @@ public final class Gson {
|
|||||||
*
|
*
|
||||||
* @param src the object for which JSON representation is to be created
|
* @param src the object for which JSON representation is to be created
|
||||||
* @param typeOfSrc The specific genericized type of src. You can obtain
|
* @param typeOfSrc The specific genericized type of src. You can obtain
|
||||||
* this type by using the {@link org.mcteam.factions.gson.reflect.TypeToken} class. For example,
|
* this type by using the {@link com.massivecraft.factions.gson.reflect.TypeToken} class. For example,
|
||||||
* to get the type for {@code Collection<Foo>}, you should use:
|
* to get the type for {@code Collection<Foo>}, you should use:
|
||||||
* <pre>
|
* <pre>
|
||||||
* Type typeOfSrc = new TypeToken<Collection<Foo>>(){}.getType();
|
* Type typeOfSrc = new TypeToken<Collection<Foo>>(){}.getType();
|
||||||
@ -290,7 +291,7 @@ public final class Gson {
|
|||||||
*
|
*
|
||||||
* @param src the object for which JSON representation is to be created
|
* @param src the object for which JSON representation is to be created
|
||||||
* @param typeOfSrc The specific genericized type of src. You can obtain
|
* @param typeOfSrc The specific genericized type of src. You can obtain
|
||||||
* this type by using the {@link org.mcteam.factions.gson.reflect.TypeToken} class. For example,
|
* this type by using the {@link com.massivecraft.factions.gson.reflect.TypeToken} class. For example,
|
||||||
* to get the type for {@code Collection<Foo>}, you should use:
|
* to get the type for {@code Collection<Foo>}, you should use:
|
||||||
* <pre>
|
* <pre>
|
||||||
* Type typeOfSrc = new TypeToken<Collection<Foo>>(){}.getType();
|
* Type typeOfSrc = new TypeToken<Collection<Foo>>(){}.getType();
|
||||||
@ -399,7 +400,7 @@ public final class Gson {
|
|||||||
* @param <T> the type of the desired object
|
* @param <T> the type of the desired object
|
||||||
* @param json the string from which the object is to be deserialized
|
* @param json the string from which the object is to be deserialized
|
||||||
* @param typeOfT The specific genericized type of src. You can obtain this type by using the
|
* @param typeOfT The specific genericized type of src. You can obtain this type by using the
|
||||||
* {@link org.mcteam.factions.gson.reflect.TypeToken} class. For example, to get the type for
|
* {@link com.massivecraft.factions.gson.reflect.TypeToken} class. For example, to get the type for
|
||||||
* {@code Collection<Foo>}, you should use:
|
* {@code Collection<Foo>}, you should use:
|
||||||
* <pre>
|
* <pre>
|
||||||
* Type typeOfT = new TypeToken<Collection<Foo>>(){}.getType();
|
* Type typeOfT = new TypeToken<Collection<Foo>>(){}.getType();
|
||||||
@ -452,7 +453,7 @@ public final class Gson {
|
|||||||
* @param <T> the type of the desired object
|
* @param <T> the type of the desired object
|
||||||
* @param json the reader producing Json from which the object is to be deserialized
|
* @param json the reader producing Json from which the object is to be deserialized
|
||||||
* @param typeOfT The specific genericized type of src. You can obtain this type by using the
|
* @param typeOfT The specific genericized type of src. You can obtain this type by using the
|
||||||
* {@link org.mcteam.factions.gson.reflect.TypeToken} class. For example, to get the type for
|
* {@link com.massivecraft.factions.gson.reflect.TypeToken} class. For example, to get the type for
|
||||||
* {@code Collection<Foo>}, you should use:
|
* {@code Collection<Foo>}, you should use:
|
||||||
* <pre>
|
* <pre>
|
||||||
* Type typeOfT = new TypeToken<Collection<Foo>>(){}.getType();
|
* Type typeOfT = new TypeToken<Collection<Foo>>(){}.getType();
|
||||||
@ -531,7 +532,7 @@ public final class Gson {
|
|||||||
* @param json the root of the parse tree of {@link JsonElement}s from which the object is to
|
* @param json the root of the parse tree of {@link JsonElement}s from which the object is to
|
||||||
* be deserialized
|
* be deserialized
|
||||||
* @param typeOfT The specific genericized type of src. You can obtain this type by using the
|
* @param typeOfT The specific genericized type of src. You can obtain this type by using the
|
||||||
* {@link org.mcteam.factions.gson.reflect.TypeToken} class. For example, to get the type for
|
* {@link com.massivecraft.factions.gson.reflect.TypeToken} class. For example, to get the type for
|
||||||
* {@code Collection<Foo>}, you should use:
|
* {@code Collection<Foo>}, you should use:
|
||||||
* <pre>
|
* <pre>
|
||||||
* Type typeOfT = new TypeToken<Collection<Foo>>(){}.getType();
|
* Type typeOfT = new TypeToken<Collection<Foo>>(){}.getType();
|
@ -14,10 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import org.mcteam.factions.gson.DefaultTypeAdapters.DefaultDateTypeAdapter;
|
import com.massivecraft.factions.gson.DefaultTypeAdapters.DefaultDateTypeAdapter;
|
||||||
import org.mcteam.factions.gson.internal.$Gson$Preconditions;
|
import com.massivecraft.factions.gson.internal.$Gson$Preconditions;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
@ -174,7 +174,7 @@ public final class GsonBuilder {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures Gson to exclude all fields from consideration for serialization or deserialization
|
* Configures Gson to exclude all fields from consideration for serialization or deserialization
|
||||||
* that do not have the {@link org.mcteam.factions.gson.annotations.Expose} annotation.
|
* that do not have the {@link com.massivecraft.factions.gson.annotations.Expose} annotation.
|
||||||
*
|
*
|
||||||
* @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern
|
* @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern
|
||||||
*/
|
*/
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
@ -14,9 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import org.mcteam.factions.gson.internal.$Gson$Types;
|
import com.massivecraft.factions.gson.internal.$Gson$Types;
|
||||||
|
|
||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
@ -1,89 +1,89 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2008 Google Inc.
|
* Copyright (C) 2008 Google Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* implementation of a deserialization context for Gson
|
* implementation of a deserialization context for Gson
|
||||||
*
|
*
|
||||||
* @author Inderjeet Singh
|
* @author Inderjeet Singh
|
||||||
*/
|
*/
|
||||||
final class JsonDeserializationContextDefault implements JsonDeserializationContext {
|
final class JsonDeserializationContextDefault implements JsonDeserializationContext {
|
||||||
|
|
||||||
private final ObjectNavigator objectNavigator;
|
private final ObjectNavigator objectNavigator;
|
||||||
private final FieldNamingStrategy2 fieldNamingPolicy;
|
private final FieldNamingStrategy2 fieldNamingPolicy;
|
||||||
private final ParameterizedTypeHandlerMap<JsonDeserializer<?>> deserializers;
|
private final ParameterizedTypeHandlerMap<JsonDeserializer<?>> deserializers;
|
||||||
private final MappedObjectConstructor objectConstructor;
|
private final MappedObjectConstructor objectConstructor;
|
||||||
|
|
||||||
JsonDeserializationContextDefault(ObjectNavigator objectNavigator,
|
JsonDeserializationContextDefault(ObjectNavigator objectNavigator,
|
||||||
FieldNamingStrategy2 fieldNamingPolicy,
|
FieldNamingStrategy2 fieldNamingPolicy,
|
||||||
ParameterizedTypeHandlerMap<JsonDeserializer<?>> deserializers,
|
ParameterizedTypeHandlerMap<JsonDeserializer<?>> deserializers,
|
||||||
MappedObjectConstructor objectConstructor) {
|
MappedObjectConstructor objectConstructor) {
|
||||||
this.objectNavigator = objectNavigator;
|
this.objectNavigator = objectNavigator;
|
||||||
this.fieldNamingPolicy = fieldNamingPolicy;
|
this.fieldNamingPolicy = fieldNamingPolicy;
|
||||||
this.deserializers = deserializers;
|
this.deserializers = deserializers;
|
||||||
this.objectConstructor = objectConstructor;
|
this.objectConstructor = objectConstructor;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectConstructor getObjectConstructor() {
|
ObjectConstructor getObjectConstructor() {
|
||||||
return objectConstructor;
|
return objectConstructor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T> T deserialize(JsonElement json, Type typeOfT) throws JsonParseException {
|
public <T> T deserialize(JsonElement json, Type typeOfT) throws JsonParseException {
|
||||||
if (json == null || json.isJsonNull()) {
|
if (json == null || json.isJsonNull()) {
|
||||||
return null;
|
return null;
|
||||||
} else if (json.isJsonArray()) {
|
} else if (json.isJsonArray()) {
|
||||||
return (T) fromJsonArray(typeOfT, json.getAsJsonArray(), this);
|
return (T) fromJsonArray(typeOfT, json.getAsJsonArray(), this);
|
||||||
} else if (json.isJsonObject()) {
|
} else if (json.isJsonObject()) {
|
||||||
return (T) fromJsonObject(typeOfT, json.getAsJsonObject(), this);
|
return (T) fromJsonObject(typeOfT, json.getAsJsonObject(), this);
|
||||||
} else if (json.isJsonPrimitive()) {
|
} else if (json.isJsonPrimitive()) {
|
||||||
return (T) fromJsonPrimitive(typeOfT, json.getAsJsonPrimitive(), this);
|
return (T) fromJsonPrimitive(typeOfT, json.getAsJsonPrimitive(), this);
|
||||||
} else {
|
} else {
|
||||||
throw new JsonParseException("Failed parsing JSON source: " + json + " to Json");
|
throw new JsonParseException("Failed parsing JSON source: " + json + " to Json");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> T fromJsonArray(Type arrayType, JsonArray jsonArray,
|
private <T> T fromJsonArray(Type arrayType, JsonArray jsonArray,
|
||||||
JsonDeserializationContext context) throws JsonParseException {
|
JsonDeserializationContext context) throws JsonParseException {
|
||||||
JsonArrayDeserializationVisitor<T> visitor = new JsonArrayDeserializationVisitor<T>(
|
JsonArrayDeserializationVisitor<T> visitor = new JsonArrayDeserializationVisitor<T>(
|
||||||
jsonArray, arrayType, objectNavigator, fieldNamingPolicy,
|
jsonArray, arrayType, objectNavigator, fieldNamingPolicy,
|
||||||
objectConstructor, deserializers, context);
|
objectConstructor, deserializers, context);
|
||||||
objectNavigator.accept(new ObjectTypePair(null, arrayType, true), visitor);
|
objectNavigator.accept(new ObjectTypePair(null, arrayType, true), visitor);
|
||||||
return visitor.getTarget();
|
return visitor.getTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> T fromJsonObject(Type typeOfT, JsonObject jsonObject,
|
private <T> T fromJsonObject(Type typeOfT, JsonObject jsonObject,
|
||||||
JsonDeserializationContext context) throws JsonParseException {
|
JsonDeserializationContext context) throws JsonParseException {
|
||||||
JsonObjectDeserializationVisitor<T> visitor = new JsonObjectDeserializationVisitor<T>(
|
JsonObjectDeserializationVisitor<T> visitor = new JsonObjectDeserializationVisitor<T>(
|
||||||
jsonObject, typeOfT, objectNavigator, fieldNamingPolicy,
|
jsonObject, typeOfT, objectNavigator, fieldNamingPolicy,
|
||||||
objectConstructor, deserializers, context);
|
objectConstructor, deserializers, context);
|
||||||
objectNavigator.accept(new ObjectTypePair(null, typeOfT, true), visitor);
|
objectNavigator.accept(new ObjectTypePair(null, typeOfT, true), visitor);
|
||||||
return visitor.getTarget();
|
return visitor.getTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private <T> T fromJsonPrimitive(Type typeOfT, JsonPrimitive json,
|
private <T> T fromJsonPrimitive(Type typeOfT, JsonPrimitive json,
|
||||||
JsonDeserializationContext context) throws JsonParseException {
|
JsonDeserializationContext context) throws JsonParseException {
|
||||||
JsonObjectDeserializationVisitor<T> visitor = new JsonObjectDeserializationVisitor<T>(
|
JsonObjectDeserializationVisitor<T> visitor = new JsonObjectDeserializationVisitor<T>(
|
||||||
json, typeOfT, objectNavigator, fieldNamingPolicy, objectConstructor, deserializers, context);
|
json, typeOfT, objectNavigator, fieldNamingPolicy, objectConstructor, deserializers, context);
|
||||||
objectNavigator.accept(new ObjectTypePair(json.getAsObject(), typeOfT, true), visitor);
|
objectNavigator.accept(new ObjectTypePair(json.getAsObject(), typeOfT, true), visitor);
|
||||||
Object target = visitor.getTarget();
|
Object target = visitor.getTarget();
|
||||||
return (T) target;
|
return (T) target;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,9 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import org.mcteam.factions.gson.internal.$Gson$Preconditions;
|
import com.massivecraft.factions.gson.internal.$Gson$Preconditions;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
@ -14,9 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import org.mcteam.factions.gson.internal.$Gson$Preconditions;
|
import com.massivecraft.factions.gson.internal.$Gson$Preconditions;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
@ -1,47 +1,47 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2008 Google Inc.
|
* Copyright (C) 2008 Google Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Definition of a visitor for a JsonElement tree.
|
* Definition of a visitor for a JsonElement tree.
|
||||||
*
|
*
|
||||||
* @author Inderjeet Singh
|
* @author Inderjeet Singh
|
||||||
*/
|
*/
|
||||||
interface JsonElementVisitor {
|
interface JsonElementVisitor {
|
||||||
void visitPrimitive(JsonPrimitive primitive) throws IOException;
|
void visitPrimitive(JsonPrimitive primitive) throws IOException;
|
||||||
void visitNull() throws IOException;
|
void visitNull() throws IOException;
|
||||||
|
|
||||||
void startArray(JsonArray array) throws IOException;
|
void startArray(JsonArray array) throws IOException;
|
||||||
void visitArrayMember(JsonArray parent, JsonPrimitive member, boolean isFirst) throws IOException;
|
void visitArrayMember(JsonArray parent, JsonPrimitive member, boolean isFirst) throws IOException;
|
||||||
void visitArrayMember(JsonArray parent, JsonArray member, boolean isFirst) throws IOException;
|
void visitArrayMember(JsonArray parent, JsonArray member, boolean isFirst) throws IOException;
|
||||||
void visitArrayMember(JsonArray parent, JsonObject member, boolean isFirst) throws IOException;
|
void visitArrayMember(JsonArray parent, JsonObject member, boolean isFirst) throws IOException;
|
||||||
void visitNullArrayMember(JsonArray parent, boolean isFirst) throws IOException;
|
void visitNullArrayMember(JsonArray parent, boolean isFirst) throws IOException;
|
||||||
void endArray(JsonArray array) throws IOException;
|
void endArray(JsonArray array) throws IOException;
|
||||||
|
|
||||||
void startObject(JsonObject object) throws IOException;
|
void startObject(JsonObject object) throws IOException;
|
||||||
void visitObjectMember(JsonObject parent, String memberName, JsonPrimitive member,
|
void visitObjectMember(JsonObject parent, String memberName, JsonPrimitive member,
|
||||||
boolean isFirst) throws IOException;
|
boolean isFirst) throws IOException;
|
||||||
void visitObjectMember(JsonObject parent, String memberName, JsonArray member,
|
void visitObjectMember(JsonObject parent, String memberName, JsonArray member,
|
||||||
boolean isFirst) throws IOException;
|
boolean isFirst) throws IOException;
|
||||||
void visitObjectMember(JsonObject parent, String memberName, JsonObject member,
|
void visitObjectMember(JsonObject parent, String memberName, JsonObject member,
|
||||||
boolean isFirst) throws IOException;
|
boolean isFirst) throws IOException;
|
||||||
void visitNullObjectMember(JsonObject parent, String memberName,
|
void visitNullObjectMember(JsonObject parent, String memberName,
|
||||||
boolean isFirst) throws IOException;
|
boolean isFirst) throws IOException;
|
||||||
void endObject(JsonObject object) throws IOException;
|
void endObject(JsonObject object) throws IOException;
|
||||||
}
|
}
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This exception is raised when Gson was unable to read an input stream
|
* This exception is raised when Gson was unable to read an input stream
|
@ -1,72 +1,72 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2008 Google Inc.
|
* Copyright (C) 2008 Google Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class representing a Json {@code null} value.
|
* A class representing a Json {@code null} value.
|
||||||
*
|
*
|
||||||
* @author Inderjeet Singh
|
* @author Inderjeet Singh
|
||||||
* @author Joel Leitch
|
* @author Joel Leitch
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
public final class JsonNull extends JsonElement {
|
public final class JsonNull extends JsonElement {
|
||||||
private static final JsonNull INSTANCE = new JsonNull();
|
private static final JsonNull INSTANCE = new JsonNull();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new JsonNull object.
|
* Creates a new JsonNull object.
|
||||||
*/
|
*/
|
||||||
public JsonNull() {
|
public JsonNull() {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void toString(Appendable sb, Escaper escaper) throws IOException {
|
protected void toString(Appendable sb, Escaper escaper) throws IOException {
|
||||||
sb.append("null");
|
sb.append("null");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All instances of JsonNull have the same hash code since they are indistinguishable
|
* All instances of JsonNull have the same hash code since they are indistinguishable
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return JsonNull.class.hashCode();
|
return JsonNull.class.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All instances of JsonNull are the same
|
* All instances of JsonNull are the same
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
return this == other || other instanceof JsonNull;
|
return this == other || other instanceof JsonNull;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creation method used to return an instance of a {@link JsonNull}. To reduce the memory
|
* Creation method used to return an instance of a {@link JsonNull}. To reduce the memory
|
||||||
* footprint, a single object has been created for this class; therefore the same instance is
|
* footprint, a single object has been created for this class; therefore the same instance is
|
||||||
* being returned for each invocation of this method. This method is kept private since we
|
* being returned for each invocation of this method. This method is kept private since we
|
||||||
* prefer the users to use {@link JsonNull#JsonNull()} which is similar to how other JsonElements
|
* prefer the users to use {@link JsonNull#JsonNull()} which is similar to how other JsonElements
|
||||||
* are created. Note that all instances of JsonNull return true for {@link #equals(Object)}
|
* are created. Note that all instances of JsonNull return true for {@link #equals(Object)}
|
||||||
* when compared to each other.
|
* when compared to each other.
|
||||||
*
|
*
|
||||||
* @return a instance of a {@link JsonNull}
|
* @return a instance of a {@link JsonNull}
|
||||||
*/
|
*/
|
||||||
static JsonNull createJsonNull() {
|
static JsonNull createJsonNull() {
|
||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,9 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import org.mcteam.factions.gson.internal.$Gson$Preconditions;
|
import com.massivecraft.factions.gson.internal.$Gson$Preconditions;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This exception is raised if there is a serious issue that occurs during parsing of a Json
|
* This exception is raised if there is a serious issue that occurs during parsing of a Json
|
@ -1,97 +1,98 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2009 Google Inc.
|
* Copyright (C) 2009 Google Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import org.mcteam.factions.gson.stream.JsonReader;
|
import com.massivecraft.factions.gson.stream.JsonReader;
|
||||||
import org.mcteam.factions.gson.stream.JsonToken;
|
import com.massivecraft.factions.gson.stream.JsonToken;
|
||||||
import org.mcteam.factions.gson.stream.MalformedJsonException;
|
import com.massivecraft.factions.gson.stream.MalformedJsonException;
|
||||||
import java.io.EOFException;
|
|
||||||
import java.io.IOException;
|
import java.io.EOFException;
|
||||||
import java.io.Reader;
|
import java.io.IOException;
|
||||||
import java.io.StringReader;
|
import java.io.Reader;
|
||||||
|
import java.io.StringReader;
|
||||||
/**
|
|
||||||
* A parser to parse Json into a parse tree of {@link JsonElement}s
|
/**
|
||||||
*
|
* A parser to parse Json into a parse tree of {@link JsonElement}s
|
||||||
* @author Inderjeet Singh
|
*
|
||||||
* @author Joel Leitch
|
* @author Inderjeet Singh
|
||||||
* @since 1.3
|
* @author Joel Leitch
|
||||||
*/
|
* @since 1.3
|
||||||
public final class JsonParser {
|
*/
|
||||||
|
public final class JsonParser {
|
||||||
/**
|
|
||||||
* Parses the specified JSON string into a parse tree
|
/**
|
||||||
*
|
* Parses the specified JSON string into a parse tree
|
||||||
* @param json JSON text
|
*
|
||||||
* @return a parse tree of {@link JsonElement}s corresponding to the specified JSON
|
* @param json JSON text
|
||||||
* @throws JsonParseException if the specified text is not valid JSON
|
* @return a parse tree of {@link JsonElement}s corresponding to the specified JSON
|
||||||
* @since 1.3
|
* @throws JsonParseException if the specified text is not valid JSON
|
||||||
*/
|
* @since 1.3
|
||||||
public JsonElement parse(String json) throws JsonSyntaxException {
|
*/
|
||||||
return parse(new StringReader(json));
|
public JsonElement parse(String json) throws JsonSyntaxException {
|
||||||
}
|
return parse(new StringReader(json));
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Parses the specified JSON string into a parse tree
|
/**
|
||||||
*
|
* Parses the specified JSON string into a parse tree
|
||||||
* @param json JSON text
|
*
|
||||||
* @return a parse tree of {@link JsonElement}s corresponding to the specified JSON
|
* @param json JSON text
|
||||||
* @throws JsonParseException if the specified text is not valid JSON
|
* @return a parse tree of {@link JsonElement}s corresponding to the specified JSON
|
||||||
* @since 1.3
|
* @throws JsonParseException if the specified text is not valid JSON
|
||||||
*/
|
* @since 1.3
|
||||||
public JsonElement parse(Reader json) throws JsonIOException, JsonSyntaxException {
|
*/
|
||||||
try {
|
public JsonElement parse(Reader json) throws JsonIOException, JsonSyntaxException {
|
||||||
JsonReader jsonReader = new JsonReader(json);
|
try {
|
||||||
JsonElement element = parse(jsonReader);
|
JsonReader jsonReader = new JsonReader(json);
|
||||||
if (!element.isJsonNull() && jsonReader.peek() != JsonToken.END_DOCUMENT) {
|
JsonElement element = parse(jsonReader);
|
||||||
throw new JsonSyntaxException("Did not consume the entire document.");
|
if (!element.isJsonNull() && jsonReader.peek() != JsonToken.END_DOCUMENT) {
|
||||||
}
|
throw new JsonSyntaxException("Did not consume the entire document.");
|
||||||
return element;
|
}
|
||||||
} catch (MalformedJsonException e) {
|
return element;
|
||||||
throw new JsonSyntaxException(e);
|
} catch (MalformedJsonException e) {
|
||||||
} catch (IOException e) {
|
throw new JsonSyntaxException(e);
|
||||||
throw new JsonIOException(e);
|
} catch (IOException e) {
|
||||||
} catch (NumberFormatException e) {
|
throw new JsonIOException(e);
|
||||||
throw new JsonSyntaxException(e);
|
} catch (NumberFormatException e) {
|
||||||
}
|
throw new JsonSyntaxException(e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Returns the next value from the JSON stream as a parse tree.
|
/**
|
||||||
*
|
* Returns the next value from the JSON stream as a parse tree.
|
||||||
* @throws JsonParseException if there is an IOException or if the specified
|
*
|
||||||
* text is not valid JSON
|
* @throws JsonParseException if there is an IOException or if the specified
|
||||||
* @since 1.6
|
* text is not valid JSON
|
||||||
*/
|
* @since 1.6
|
||||||
public JsonElement parse(JsonReader json) throws JsonIOException, JsonSyntaxException {
|
*/
|
||||||
boolean lenient = json.isLenient();
|
public JsonElement parse(JsonReader json) throws JsonIOException, JsonSyntaxException {
|
||||||
json.setLenient(true);
|
boolean lenient = json.isLenient();
|
||||||
try {
|
json.setLenient(true);
|
||||||
return Streams.parse(json);
|
try {
|
||||||
} catch (StackOverflowError e) {
|
return Streams.parse(json);
|
||||||
throw new JsonParseException("Failed parsing JSON source: " + json + " to Json", e);
|
} catch (StackOverflowError e) {
|
||||||
} catch (OutOfMemoryError e) {
|
throw new JsonParseException("Failed parsing JSON source: " + json + " to Json", e);
|
||||||
throw new JsonParseException("Failed parsing JSON source: " + json + " to Json", e);
|
} catch (OutOfMemoryError e) {
|
||||||
} catch (JsonParseException e) {
|
throw new JsonParseException("Failed parsing JSON source: " + json + " to Json", e);
|
||||||
if (e.getCause() instanceof EOFException) {
|
} catch (JsonParseException e) {
|
||||||
return JsonNull.createJsonNull();
|
if (e.getCause() instanceof EOFException) {
|
||||||
}
|
return JsonNull.createJsonNull();
|
||||||
throw e;
|
}
|
||||||
} finally {
|
throw e;
|
||||||
json.setLenient(lenient);
|
} finally {
|
||||||
}
|
json.setLenient(lenient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
@ -14,9 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import org.mcteam.factions.gson.internal.$Gson$Preconditions;
|
import com.massivecraft.factions.gson.internal.$Gson$Preconditions;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
@ -1,65 +1,65 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2008 Google Inc.
|
* Copyright (C) 2008 Google Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An implementation of serialization context for Gson.
|
* An implementation of serialization context for Gson.
|
||||||
*
|
*
|
||||||
* @author Inderjeet Singh
|
* @author Inderjeet Singh
|
||||||
*/
|
*/
|
||||||
final class JsonSerializationContextDefault implements JsonSerializationContext {
|
final class JsonSerializationContextDefault implements JsonSerializationContext {
|
||||||
|
|
||||||
private final ObjectNavigator objectNavigator;
|
private final ObjectNavigator objectNavigator;
|
||||||
private final FieldNamingStrategy2 fieldNamingPolicy;
|
private final FieldNamingStrategy2 fieldNamingPolicy;
|
||||||
private final ParameterizedTypeHandlerMap<JsonSerializer<?>> serializers;
|
private final ParameterizedTypeHandlerMap<JsonSerializer<?>> serializers;
|
||||||
private final boolean serializeNulls;
|
private final boolean serializeNulls;
|
||||||
private final MemoryRefStack ancestors;
|
private final MemoryRefStack ancestors;
|
||||||
|
|
||||||
JsonSerializationContextDefault(ObjectNavigator objectNavigator,
|
JsonSerializationContextDefault(ObjectNavigator objectNavigator,
|
||||||
FieldNamingStrategy2 fieldNamingPolicy, boolean serializeNulls,
|
FieldNamingStrategy2 fieldNamingPolicy, boolean serializeNulls,
|
||||||
ParameterizedTypeHandlerMap<JsonSerializer<?>> serializers) {
|
ParameterizedTypeHandlerMap<JsonSerializer<?>> serializers) {
|
||||||
this.objectNavigator = objectNavigator;
|
this.objectNavigator = objectNavigator;
|
||||||
this.fieldNamingPolicy = fieldNamingPolicy;
|
this.fieldNamingPolicy = fieldNamingPolicy;
|
||||||
this.serializeNulls = serializeNulls;
|
this.serializeNulls = serializeNulls;
|
||||||
this.serializers = serializers;
|
this.serializers = serializers;
|
||||||
this.ancestors = new MemoryRefStack();
|
this.ancestors = new MemoryRefStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
public JsonElement serialize(Object src) {
|
public JsonElement serialize(Object src) {
|
||||||
if (src == null) {
|
if (src == null) {
|
||||||
return JsonNull.createJsonNull();
|
return JsonNull.createJsonNull();
|
||||||
}
|
}
|
||||||
return serialize(src, src.getClass(), false);
|
return serialize(src, src.getClass(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JsonElement serialize(Object src, Type typeOfSrc) {
|
public JsonElement serialize(Object src, Type typeOfSrc) {
|
||||||
return serialize(src, typeOfSrc, true);
|
return serialize(src, typeOfSrc, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonElement serialize(Object src, Type typeOfSrc, boolean preserveType) {
|
JsonElement serialize(Object src, Type typeOfSrc, boolean preserveType) {
|
||||||
if (src == null) {
|
if (src == null) {
|
||||||
return JsonNull.createJsonNull();
|
return JsonNull.createJsonNull();
|
||||||
}
|
}
|
||||||
JsonSerializationVisitor visitor = new JsonSerializationVisitor(
|
JsonSerializationVisitor visitor = new JsonSerializationVisitor(
|
||||||
objectNavigator, fieldNamingPolicy, serializeNulls, serializers, this, ancestors);
|
objectNavigator, fieldNamingPolicy, serializeNulls, serializers, this, ancestors);
|
||||||
objectNavigator.accept(new ObjectTypePair(src, typeOfSrc, preserveType), visitor);
|
objectNavigator.accept(new ObjectTypePair(src, typeOfSrc, preserveType), visitor);
|
||||||
return visitor.getJsonElement();
|
return visitor.getJsonElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,10 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import org.mcteam.factions.gson.internal.$Gson$Types;
|
import com.massivecraft.factions.gson.internal.$Gson$Preconditions;
|
||||||
import org.mcteam.factions.gson.internal.$Gson$Preconditions;
|
import com.massivecraft.factions.gson.internal.$Gson$Types;
|
||||||
|
|
||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
@ -14,14 +14,14 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface representing a custom serializer for Json. You should write a custom serializer, if
|
* Interface representing a custom serializer for Json. You should write a custom serializer, if
|
||||||
* you are not happy with the default serialization done by Gson. You will also need to register
|
* you are not happy with the default serialization done by Gson. You will also need to register
|
||||||
* this serializer through {@link org.mcteam.factions.gson.GsonBuilder#registerTypeAdapter(Type, Object)}.
|
* this serializer through {@link com.massivecraft.factions.gson.GsonBuilder#registerTypeAdapter(Type, Object)}.
|
||||||
*
|
*
|
||||||
* <p>Let us look at example where defining a serializer will be useful. The {@code Id} class
|
* <p>Let us look at example where defining a serializer will be useful. The {@code Id} class
|
||||||
* defined below has two fields: {@code clazz} and {@code value}.</p>
|
* defined below has two fields: {@code clazz} and {@code value}.</p>
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import java.io.EOFException;
|
import java.io.EOFException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -22,9 +22,9 @@ import java.io.StringReader;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
import org.mcteam.factions.gson.stream.JsonReader;
|
import com.massivecraft.factions.gson.stream.JsonReader;
|
||||||
import org.mcteam.factions.gson.stream.JsonToken;
|
import com.massivecraft.factions.gson.stream.JsonToken;
|
||||||
import org.mcteam.factions.gson.stream.MalformedJsonException;
|
import com.massivecraft.factions.gson.stream.MalformedJsonException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A streaming parser that allows reading of multiple {@link JsonElement}s from the specified reader
|
* A streaming parser that allows reading of multiple {@link JsonElement}s from the specified reader
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This exception is raised when Gson attempts to read (or write) a malformed
|
* This exception is raised when Gson attempts to read (or write) a malformed
|
@ -1,111 +1,111 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2008 Google Inc.
|
* Copyright (C) 2008 Google Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A navigator to navigate a tree of JsonElement nodes in Depth-first order
|
* A navigator to navigate a tree of JsonElement nodes in Depth-first order
|
||||||
*
|
*
|
||||||
* @author Inderjeet Singh
|
* @author Inderjeet Singh
|
||||||
*/
|
*/
|
||||||
final class JsonTreeNavigator {
|
final class JsonTreeNavigator {
|
||||||
private final JsonElementVisitor visitor;
|
private final JsonElementVisitor visitor;
|
||||||
private final boolean visitNulls;
|
private final boolean visitNulls;
|
||||||
|
|
||||||
JsonTreeNavigator(JsonElementVisitor visitor, boolean visitNulls) {
|
JsonTreeNavigator(JsonElementVisitor visitor, boolean visitNulls) {
|
||||||
this.visitor = visitor;
|
this.visitor = visitor;
|
||||||
this.visitNulls = visitNulls;
|
this.visitNulls = visitNulls;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void navigate(JsonElement element) throws IOException {
|
public void navigate(JsonElement element) throws IOException {
|
||||||
if (element.isJsonNull()) {
|
if (element.isJsonNull()) {
|
||||||
visitor.visitNull();
|
visitor.visitNull();
|
||||||
} else if (element.isJsonArray()) {
|
} else if (element.isJsonArray()) {
|
||||||
JsonArray array = element.getAsJsonArray();
|
JsonArray array = element.getAsJsonArray();
|
||||||
visitor.startArray(array);
|
visitor.startArray(array);
|
||||||
boolean isFirst = true;
|
boolean isFirst = true;
|
||||||
for (JsonElement child : array) {
|
for (JsonElement child : array) {
|
||||||
visitChild(array, child, isFirst);
|
visitChild(array, child, isFirst);
|
||||||
if (isFirst) {
|
if (isFirst) {
|
||||||
isFirst = false;
|
isFirst = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
visitor.endArray(array);
|
visitor.endArray(array);
|
||||||
} else if (element.isJsonObject()) {
|
} else if (element.isJsonObject()) {
|
||||||
JsonObject object = element.getAsJsonObject();
|
JsonObject object = element.getAsJsonObject();
|
||||||
visitor.startObject(object);
|
visitor.startObject(object);
|
||||||
boolean isFirst = true;
|
boolean isFirst = true;
|
||||||
for (Map.Entry<String, JsonElement> member : object.entrySet()) {
|
for (Map.Entry<String, JsonElement> member : object.entrySet()) {
|
||||||
boolean visited = visitChild(object, member.getKey(), member.getValue(), isFirst);
|
boolean visited = visitChild(object, member.getKey(), member.getValue(), isFirst);
|
||||||
if (visited && isFirst) {
|
if (visited && isFirst) {
|
||||||
isFirst = false;
|
isFirst = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
visitor.endObject(object);
|
visitor.endObject(object);
|
||||||
} else { // must be JsonPrimitive
|
} else { // must be JsonPrimitive
|
||||||
visitor.visitPrimitive(element.getAsJsonPrimitive());
|
visitor.visitPrimitive(element.getAsJsonPrimitive());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the child was visited, false if it was skipped.
|
* Returns true if the child was visited, false if it was skipped.
|
||||||
*/
|
*/
|
||||||
private boolean visitChild(JsonObject parent, String childName, JsonElement child,
|
private boolean visitChild(JsonObject parent, String childName, JsonElement child,
|
||||||
boolean isFirst) throws IOException {
|
boolean isFirst) throws IOException {
|
||||||
if (child.isJsonNull()) {
|
if (child.isJsonNull()) {
|
||||||
if (visitNulls) {
|
if (visitNulls) {
|
||||||
visitor.visitNullObjectMember(parent, childName, isFirst);
|
visitor.visitNullObjectMember(parent, childName, isFirst);
|
||||||
navigate(child.getAsJsonNull());
|
navigate(child.getAsJsonNull());
|
||||||
} else { // Null value is being skipped.
|
} else { // Null value is being skipped.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (child.isJsonArray()) {
|
} else if (child.isJsonArray()) {
|
||||||
JsonArray childAsArray = child.getAsJsonArray();
|
JsonArray childAsArray = child.getAsJsonArray();
|
||||||
visitor.visitObjectMember(parent, childName, childAsArray, isFirst);
|
visitor.visitObjectMember(parent, childName, childAsArray, isFirst);
|
||||||
navigate(childAsArray);
|
navigate(childAsArray);
|
||||||
} else if (child.isJsonObject()) {
|
} else if (child.isJsonObject()) {
|
||||||
JsonObject childAsObject = child.getAsJsonObject();
|
JsonObject childAsObject = child.getAsJsonObject();
|
||||||
visitor.visitObjectMember(parent, childName, childAsObject, isFirst);
|
visitor.visitObjectMember(parent, childName, childAsObject, isFirst);
|
||||||
navigate(childAsObject);
|
navigate(childAsObject);
|
||||||
} else { // is a JsonPrimitive
|
} else { // is a JsonPrimitive
|
||||||
visitor.visitObjectMember(parent, childName, child.getAsJsonPrimitive(), isFirst);
|
visitor.visitObjectMember(parent, childName, child.getAsJsonPrimitive(), isFirst);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the child was visited, false if it was skipped.
|
* Returns true if the child was visited, false if it was skipped.
|
||||||
*/
|
*/
|
||||||
private void visitChild(JsonArray parent, JsonElement child, boolean isFirst) throws IOException {
|
private void visitChild(JsonArray parent, JsonElement child, boolean isFirst) throws IOException {
|
||||||
if (child.isJsonNull()) {
|
if (child.isJsonNull()) {
|
||||||
visitor.visitNullArrayMember(parent, isFirst);
|
visitor.visitNullArrayMember(parent, isFirst);
|
||||||
navigate(child);
|
navigate(child);
|
||||||
} else if (child.isJsonArray()) {
|
} else if (child.isJsonArray()) {
|
||||||
JsonArray childAsArray = child.getAsJsonArray();
|
JsonArray childAsArray = child.getAsJsonArray();
|
||||||
visitor.visitArrayMember(parent, childAsArray, isFirst);
|
visitor.visitArrayMember(parent, childAsArray, isFirst);
|
||||||
navigate(childAsArray);
|
navigate(childAsArray);
|
||||||
} else if (child.isJsonObject()) {
|
} else if (child.isJsonObject()) {
|
||||||
JsonObject childAsObject = child.getAsJsonObject();
|
JsonObject childAsObject = child.getAsJsonObject();
|
||||||
visitor.visitArrayMember(parent, childAsObject, isFirst);
|
visitor.visitArrayMember(parent, childAsObject, isFirst);
|
||||||
navigate(childAsObject);
|
navigate(childAsObject);
|
||||||
} else { // is a JsonPrimitive
|
} else { // is a JsonPrimitive
|
||||||
visitor.visitArrayMember(parent, child.getAsJsonPrimitive(), isFirst);
|
visitor.visitArrayMember(parent, child.getAsJsonPrimitive(), isFirst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the expected format for a {@code long} or {@code Long} type when its serialized.
|
* Defines the expected format for a {@code long} or {@code Long} type when its serialized.
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link FieldNamingStrategy2} that ensures the JSON field names consist of only
|
* A {@link FieldNamingStrategy2} that ensures the JSON field names consist of only
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mcteam.factions.gson;
|
package com.massivecraft.factions.gson;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user