Package Torello.Java.Additional
Class Ret4<A,B,C,D>
- java.lang.Object
-
- Torello.Java.Additional.Ret4<A,B,C,D>
-
- Type Parameters:
A
- The type of the first member-field ('a'
).B
- The type of the second member-field ('b'
).C
- The type of the third member-field ('c'
).D
- The type of the last member-field ('d'
).
- All Implemented Interfaces:
java.io.Serializable
public class Ret4<A,B,C,D> extends java.lang.Object implements java.io.Serializable
Ret4 - Documentation.
This simple generic-class allows a function to return four objects as a result, instead of just one. This is not always so useful, and can make code confusing. However there are some instances where the only alternative would be to create an entirely new class/object, when only a single method result would use that object.- See Also:
- Serialized Form
Hi-Lited Source-Code:
- View Here: Torello/Java/Additional/Ret4.java
- Open New Browser-Tab: Torello/Java/Additional/Ret4.java
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method String
toString()
-
-
-
Field Detail
-
serialVersionUID
public static final long serialVersionUID
This fulfils the SerialVersion UID requirement for all classes that implement Java'sinterface java.io.Serializable
. Using theSerializable
Implementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
1
public static final long serialVersionUID = 1;
-
a
public final A a
This holds a pointer the first response object.- Code:
- Exact Field Declaration Expression:
1
public final A a;
-
b
public final B b
This holds a pointer to the second response object.- Code:
- Exact Field Declaration Expression:
1
public final B b;
-
c
public final C c
This holds a pointer to the third response object.- Code:
- Exact Field Declaration Expression:
1
public final C c;
-
-
Method Detail
-
toString
public java.lang.String toString()
Converts this instance ofRet4
to aString
.- Overrides:
toString
in classjava.lang.Object
- Returns:
- This instance-object as a
String
. - Code:
- Exact Method Body:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
String[] types = new String[4]; types[0] = a.getClass().getSimpleName(); types[1] = b.getClass().getSimpleName(); types[2] = c.getClass().getSimpleName(); types[3] = d.getClass().getSimpleName(); int maxLen = types[0].length(); int len = 0; for (int i=1; i < 4; i++) if ((len = types[i].length()) > maxLen) maxLen = len; maxLen += 2; return "Ret4.a: " + StringParse.rightSpacePad(types[0], maxLen) + (a.getClass().isArray() ? RetHelper.toArrayString(a, types[0]) : RetHelper.indentIfNeeded(a.toString())) + '\n' + "Ret4.b: " + StringParse.rightSpacePad(types[1], maxLen) + (b.getClass().isArray() ? RetHelper.toArrayString(b, types[1]) : RetHelper.indentIfNeeded(b.toString())) + '\n' + "Ret4.c: " + StringParse.rightSpacePad(types[2], maxLen) + (c.getClass().isArray() ? RetHelper.toArrayString(c, types[2]) : RetHelper.indentIfNeeded(c.toString())) + '\n' + "Ret4.d: " + StringParse.rightSpacePad(types[3], maxLen) + (d.getClass().isArray() ? RetHelper.toArrayString(d, types[3]) : RetHelper.indentIfNeeded(d.toString()));
-
-