MCPcopy Create free account
hub / github.com/Garten/sourcecraft / getInstances

Method getInstances

src/source/addable/Addable.java:24–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22 }
23
24 public Iterable<Addable> getInstances() {
25 List<Addable> list = new LinkedList<>();
26 try {
27 Addable a = (Addable) this.getClass()
28 .getConstructors()[0].newInstance();
29 list.add(a);
30 } catch (InstantiationException ex) {
31 Loggger.warn("Addable " + this.getClass()
32 .getSimpleName() + " does not have a suitable constructor (InstantiationException)");
33 } catch (IllegalAccessException ex) {
34 Loggger.warn("Addable " + this.getClass()
35 .getSimpleName() + " does not have a suitable constructor (IllegalAccessException)");
36 } catch (IllegalArgumentException ex) {
37 Loggger.warn("Addable " + this.getClass()
38 .getSimpleName() + " does not have a suitable constructor (IllegalArgumentException)");
39 } catch (InvocationTargetException ex) {
40 Loggger.warn("Addable " + this.getClass()
41 .getSimpleName() + " does not have a suitable constructor (InvocationTargetException)");
42 }
43 return list;
44 }
45
46 public String getName() {
47 return this.getClass()

Callers 1

loadAddablesMethod · 0.45

Calls 2

warnMethod · 0.95
addMethod · 0.45

Tested by

no test coverage detected