Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

Commit

Permalink
Fixed up related class a bit, changed to switches for easier debuggin…
Browse files Browse the repository at this point in the history
…g, new jar to fit
  • Loading branch information
Doomsdayrs committed Feb 21, 2019
1 parent a3a8506 commit 9fbdc11
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 49 deletions.
Binary file added JARs/Jikan4java-0.9.G.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'java'
apply plugin: 'maven'

group = 'com.github.Doomsdayrs'
version = '0.9.F'
version = '0.9.G'

description = """Jikan4java, Java wrapper for the Jikan api"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,30 +55,29 @@ public class Related {
private ArrayList<RelatedType> alternativeSettings;

@JsonProperty("Character")
private ArrayList<RelatedType> character;
private ArrayList<RelatedType> characters;

@JsonProperty("Full story")
private ArrayList<RelatedType> fullStories;

public ArrayList<RelatedType> get(Relates type) {
if (type.getId() == 0) {
return prequel;
} else if (type.getId() == 1) {
return altVersion;
} else if (type.getId() == 2) {
return spinOff;
} else if (type.getId() == 3) {
return adaptation;
} else if (type.getId() == 4) {
return summaries;
} else if (type.getId() == 5) {
return sequels;
} else if (type.getId() == 6) {
return sideStories;
} else if (type.getId() == 7) {
return parentStories;
} else if (type.getId() == 8) {
return alternativeSettings;
} else if (type.getId() == 9) {
return character;
} else return new ArrayList<>();
switch (type.getId())
{
default: return new ArrayList<>();
case 0: return prequel;
case 1: return altVersion;
case 2: return spinOff;
case 3: return adaptation;
case 4: return sequels;
case 5: return sideStories;
case 6: return other;
case 7: return parentStories;
case 8: return alternativeSettings;
case 9: return characters;
case 10: return summaries;
case 11: return fullStories;
}

}

@Override
Expand All @@ -93,7 +92,9 @@ public String toString() {
", sideStories=" + sideStories +
", other=" + other +
", parentStories=" + parentStories +
", parentStories=" + alternativeSettings +
", alternativeSettings=" + alternativeSettings +
", characters=" + characters +
", fullStories=" + fullStories +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.github.Doomsdayrs.Jikan4java.types.Support.Related;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
* This file is part of Jikan4java.
* Jikan4java is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -31,7 +29,9 @@ public enum Relates {
OTHER (6),
PARENT_STORIES(7),
ALT_SETTING(8),
CHARACTER(9);
CHARACTER(9),
SUMMARY(10),
FULL_STORIES(11);

private final int id;

Expand All @@ -45,28 +45,19 @@ public int getId() {

public static Relates getId(int id) {
switch(id) {
case 0:
return PREQUEL;
case 1:
return ALT_VERSION;
case 2:
return SPIN_OFF;
case 3:
return ADAPTATION;
case 4:
return SEQUELS;
case 5:
return SIDE_STORIES;
case 6:
return OTHER;
case 7:
return PARENT_STORIES;
case 8:
return ALT_SETTING;
case 9:
return CHARACTER;
default:
return null;
case 0: return PREQUEL;
case 1: return ALT_VERSION;
case 2: return SPIN_OFF;
case 3: return ADAPTATION;
case 4: return SEQUELS;
case 5: return SIDE_STORIES;
case 6: return OTHER;
case 7: return PARENT_STORIES;
case 8: return ALT_SETTING;
case 9: return CHARACTER;
case 10: return SUMMARY;
case 11: return FULL_STORIES;
default: return null;
}
}

Expand Down

0 comments on commit 9fbdc11

Please sign in to comment.