File: MyClass5d.java

package info (click to toggle)
libjibx1.2-java 1.2.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 26,260 kB
  • sloc: java: 75,013; xml: 14,068; makefile: 17
file content (55 lines) | stat: -rw-r--r-- 1,577 bytes parent folder | download | duplicates (10)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

package simple;

import org.jibx.runtime.IMarshallingContext;
import org.jibx.runtime.ITrackSource;
import org.jibx.runtime.IUnmarshallingContext;

class MyClass5d extends MyClass5a
{
	/*package*/ boolean factory;
	private boolean preset;
	private boolean postset;
    private String text1;
    private String text2;
	
	private void preset(IUnmarshallingContext ctx) {
		if (!(ctx.getStackObject(1) instanceof MyClass5)) {
			throw new IllegalStateException("wrong object in stack: " +
                ctx.getStackObject(1).getClass().getName());
		}
		preset = true;
		value = 1;
	}
	
	private void postset(IUnmarshallingContext ctx) {
		if (!(ctx.getStackObject(1) instanceof MyClass5)) {
			throw new IllegalStateException("wrong object in stack: " +
                ctx.getStackObject(1).getClass().getName());
		}
		postset = true;
		if (value == 2) {
			value = 3;
		}
	}
	
	private void preget(IMarshallingContext ctx) {
		if (!(ctx.getStackObject(1) instanceof MyClass5)) {
			throw new IllegalStateException("wrong object in stack: " +
                ctx.getStackObject(1).getClass().getName());
		}
		value = 2;
	}
	
	protected void verify() {
		if (!factory || !preset || !postset) {
			throw new IllegalStateException
				("factory, pre-set, or post-set method not called");
		}
        ITrackSource track = (ITrackSource)this;
        System.out.println("Verified " + this.getClass().getName() +
            " from \"" + track.jibx_getDocumentName() + "\" (" +
            track.jibx_getLineNumber() + ":" + track.jibx_getColumnNumber() +
            ")");
	}
}