author | lana |
Tue, 23 May 2017 21:11:42 +0000 | |
changeset 45187 | 331a6542b5b8 |
parent 11087 | 3217e8ad1d4a |
permissions | -rw-r--r-- |
11087
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
1 |
/* |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
2 |
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
4 |
* |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
8 |
* |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
13 |
* accompanied this code). |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
14 |
* |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
18 |
* |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
21 |
* questions. |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
22 |
*/ |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
23 |
|
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
24 |
/* |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
25 |
* @test |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
26 |
* @bug 7087876 |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
27 |
* @summary Tests spec of the createPropertyEditor method |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
28 |
* @author Sergey Malenkov |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
29 |
*/ |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
30 |
|
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
31 |
import java.beans.IntrospectionException; |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
32 |
import java.beans.PropertyDescriptor; |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
33 |
import java.beans.PropertyEditorSupport; |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
34 |
|
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
35 |
public class Test7087876 { |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
36 |
|
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
37 |
public static void main(String[] args) throws IntrospectionException { |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
38 |
PropertyDescriptor pd = new PropertyDescriptor("value", Bean.class); |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
39 |
pd.setPropertyEditorClass(Editor.class); |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
40 |
pd.createPropertyEditor(new Bean()); |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
41 |
} |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
42 |
|
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
43 |
public static class Bean { |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
44 |
private String value; |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
45 |
|
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
46 |
public String getValue() { |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
47 |
return this.value; |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
48 |
} |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
49 |
|
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
50 |
public void setValue(String value) { |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
51 |
this.value = value; |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
52 |
} |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
53 |
} |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
54 |
|
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
55 |
public static class Editor extends PropertyEditorSupport { |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
56 |
private Editor() { |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
57 |
} |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
58 |
} |
3217e8ad1d4a
7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created
malenkov
parents:
diff
changeset
|
59 |
} |