Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/java/beans/XMLEncoder/Test8016545.java
41149 views
1
/*
2
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/*
25
* @test
26
* @bug 8016545
27
* @summary Tests beans with predefined fields
28
* @run main/othervm -Djava.security.manager=allow Test8016545
29
* @author Sergey Malenkov
30
*/
31
32
public class Test8016545 extends AbstractTest {
33
public static void main(String[] args) {
34
new Test8016545().test(true);
35
}
36
37
@Override
38
protected Object getObject() {
39
Bean bean = new Bean();
40
bean.setUndefined(Boolean.FALSE);
41
Info info = new Info();
42
info.setEnabled(Boolean.TRUE);
43
info.setID(1);
44
bean.setInfo(info);
45
return bean;
46
}
47
48
@Override
49
protected Object getAnotherObject() {
50
Bean bean = new Bean();
51
bean.setUndefined(Boolean.TRUE);
52
bean.getInfo().setEnabled(Boolean.FALSE);
53
bean.getInfo().setID(2);
54
return bean;
55
}
56
57
public static class Bean {
58
private Info info = new Info(); // predefined
59
private Boolean defined = Boolean.TRUE;
60
private Boolean undefined;
61
62
public Info getInfo() {
63
return this.info;
64
}
65
66
public void setInfo(Info info) {
67
this.info = info;
68
}
69
70
public Boolean getDefined() {
71
return this.defined;
72
}
73
74
public void setDefined(Boolean defined) {
75
this.defined = defined;
76
}
77
78
public Boolean getUndefined() {
79
return this.undefined;
80
}
81
82
public void setUndefined(Boolean undefined) {
83
this.undefined = undefined;
84
}
85
}
86
87
public static class Info {
88
private Integer id;
89
private Boolean enabled;
90
91
public Integer getID() {
92
return this.id;
93
}
94
95
public void setID(Integer id) {
96
this.id = id;
97
}
98
99
public Boolean getEnabled() {
100
return this.enabled;
101
}
102
103
public void setEnabled(Boolean enabled) {
104
this.enabled = enabled;
105
}
106
}
107
}
108
109