Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
109 lines (97 loc) · 2.85 KB

File metadata and controls

109 lines (97 loc) · 2.85 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
* Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package java.beans;
import java.lang.ref.Reference;
/**
* A BeanDescriptor provides global information about a "bean",
* including its Java class, its displayName, etc.
* <p>
* This is one of the kinds of descriptor returned by a BeanInfo object,
* which also returns descriptors for properties, method, and events.
*/
public class BeanDescriptor extends FeatureDescriptor {
private Reference<? extends Class<?>> beanClassRef;
private Reference<? extends Class<?>> customizerClassRef;
/**
* Create a BeanDescriptor for a bean that doesn't have a customizer.
*
* @param beanClass The Class object of the Java class that implements
* the bean. For example sun.beans.OurButton.class.
*/
public BeanDescriptor(Class<?> beanClass) {
this(beanClass, null);
}
/**
* Create a BeanDescriptor for a bean that has a customizer.
*
* @param beanClass The Class object of the Java class that implements
* the bean. For example sun.beans.OurButton.class.
* @param customizerClass The Class object of the Java class that implements
* the bean's Customizer. For example sun.beans.OurButtonCustomizer.class.
*/
public BeanDescriptor(Class<?> beanClass, Class<?> customizerClass) {
this.beanClassRef = getWeakReference(beanClass);
this.customizerClassRef = getWeakReference(customizerClass);
String name = beanClass.getName();
while (name.indexOf('.') >= 0) {
name = name.substring(name.indexOf('.')+1);
}
setName(name);
}
/**
* Gets the bean's Class object.
*
* @return The Class object for the bean.
*/
public Class<?> getBeanClass() {
return (this.beanClassRef != null)
? this.beanClassRef.get()
: null;
}
/**
* Gets the Class object for the bean's customizer.
*
* @return The Class object for the bean's customizer. This may
* be null if the bean doesn't have a customizer.
*/
public Class<?> getCustomizerClass() {
return (this.customizerClassRef != null)
? this.customizerClassRef.get()
: null;
}
/*
* Package-private dup constructor
* This must isolate the new object from any changes to the old object.
*/
BeanDescriptor(BeanDescriptor old) {
super(old);
beanClassRef = old.beanClassRef;
customizerClassRef = old.customizerClassRef;
}
void appendTo(StringBuilder sb) {
appendTo(sb, "beanClass", this.beanClassRef);
appendTo(sb, "customizerClass", this.customizerClassRef);
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.