Revize 97e5b58f
Přidáno uživatelem Jan Havlíček před asi 5 roky(ů)
demo_jh/Deserializer_tests/src/app/App.java | ||
---|---|---|
7 | 7 |
import java.io.ObjectInputStream; |
8 | 8 |
import java.io.ObjectOutputStream; |
9 | 9 |
import java.util.ArrayList; |
10 |
import java.util.List; |
|
10 | 11 |
import jdeserialize.Getopt; |
11 | 12 |
import jdeserialize.classdesc; |
12 | 13 |
import jdeserialize.content; |
14 |
import jdeserialize.instance; |
|
13 | 15 |
import jdeserialize.jdeserialize; |
14 | 16 |
|
15 | 17 |
public class App { |
... | ... | |
46 | 48 |
|
47 | 49 |
//gets the "contents" into an array - returnes the deserialization of all |
48 | 50 |
// 'writes' into serialized object via objectOutputStream |
49 |
ArrayList<content> cntnts = (ArrayList<content>) jd.getContent(); |
|
50 |
|
|
51 |
//gets first object of content type |
|
52 |
// - tested only with just one object. |
|
53 |
// the content here is just an interface. |
|
54 |
// The classes that implements the interface content (all of them through class contentbase) |
|
55 |
// are: arrayobj, blockdata, classdesc, classobj, enumobj, exceptionstate, instance, stringobj |
|
56 |
content locContent = cntnts.get(0); |
|
57 |
|
|
58 |
classdesc objectDescription = locContent. |
|
51 |
List cntnts = jd.getContent(); |
|
52 |
String classname = cntnts.get(0).getClass().getName(); |
|
53 |
|
|
54 |
//For my example it is alway an instance. |
|
55 |
instance locInst = (instance)cntnts.get(0); |
|
59 | 56 |
|
57 |
//parsing the instance of instance data type into JSON |
|
58 |
jdInstanceToJSON(locInst); |
|
60 | 59 |
|
61 | 60 |
int c = 0; |
62 | 61 |
} |
... | ... | |
66 | 65 |
} |
67 | 66 |
} |
68 | 67 |
|
68 |
private void jdInstanceToJSON(instance in) |
|
69 |
{ |
|
70 |
|
|
71 |
} |
|
72 |
|
|
69 | 73 |
private void jdCallMain(String filename) |
70 | 74 |
{ |
71 | 75 |
String[] myArgs= new String[1]; |
Také k dispozici: Unified diff
#7768
Got the right data type, not the conversion method though