コード例 #1
0
ファイル: Commands.java プロジェクト: CaioRanyel/MyTown2
 public static FlagType getFlagTypeFromName(String name) {
   try {
     return FlagType.valueOf(name.toUpperCase());
   } catch (IllegalArgumentException e) {
     throw new MyTownCommandException("mytown.cmd.err.flagNotExists", e, name);
   }
 }
コード例 #2
0
 @Override
 public Flag deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
     throws JsonParseException {
   JsonObject jsonObject = json.getAsJsonObject();
   FlagType flagType = FlagType.valueOf(jsonObject.get("flagType").getAsString());
   return new Flag(flagType, jsonObject.get("value").getAsString());
 }
コード例 #3
0
ファイル: Commands.java プロジェクト: CaioRanyel/MyTown2
 public static Flag getFlagFromName(Flag.Container flagsContainer, String name) {
   Flag flag;
   try {
     flag = flagsContainer.get(FlagType.valueOf(name.toUpperCase()));
   } catch (IllegalArgumentException ex) {
     throw new MyTownCommandException("mytown.cmd.err.flagNotExists", ex, name);
   }
   if (flag == null) throw new MyTownCommandException("mytown.cmd.err.flagNotExists", name);
   return flag;
 }