|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jidesoft.introspector.BeanIntrospector
public class BeanIntrospector
A helper class to introspect properties in a Java Bean and provide an easy way to integrate with PropertyTable
.
Nested Class Summary | |
---|---|
static interface |
BeanIntrospector.LazyValue
|
Field Summary | |
---|---|
static String |
PROPERTIES
|
static String |
PROPERTY
|
Constructor Summary | |
---|---|
BeanIntrospector(Class<?> clazz)
Creates a BeanIntrospector. |
|
BeanIntrospector(Class<?> clazz,
BeanInfo beanInfo)
Creates a BeanIntrospector using BeanInfo. |
|
BeanIntrospector(Class<?> clazz,
InputStream in)
Creates a BeanIntrospector using property xml file. |
|
BeanIntrospector(Class<?> clazz,
String fileName)
Creates a BeanIntrospector using property xml file. |
|
BeanIntrospector(Class<?> clazz,
String[] properties)
Creates a BeanIntrospector and allow you to pass in known properties. |
|
BeanIntrospector(Class<?> clazz,
String[] properties,
boolean filtered)
Creates a BeanIntrospector and allow you to pass in known properties. |
|
BeanIntrospector(Class<?> clazz,
String[] properties,
int count)
Creates a BeanIntrospector and allow you to pass in known properties. |
Method Summary | ||
---|---|---|
void |
addProperty(BeanProperty property)
Adds a new property. |
|
protected BeanProperty |
createBeanProperty(PropertyDescriptor pd)
Creates the bean property instance from the property descriptor. |
|
protected BeanProperty |
createBeanProperty(String name,
Class<?> clazz)
Creates the bean property instance from the property descriptor. |
|
|
createBeanTableModel(List<T> objects)
|
|
List<Property> |
createPropertyList(Object beanObject)
|
|
PropertyTableModel<Property> |
createPropertyTableModel(Object beanObject)
|
|
BeanProperty |
getProperty(String name)
Gets the property with the specified name. |
|
int |
getPropertyCount()
Gets the property count. |
|
String[] |
getPropertyNames()
Gets the properties names in an array. |
|
void |
introspectProperties(Class<?> clazz,
InputStream in,
boolean filtered)
Creates a BeanIntrospector using property xml file's input stream. |
|
void |
introspectProperties(Class<?> clazz,
String fileName,
boolean filtered)
Creates a BeanIntrospector using property xml file. |
|
void |
removeProperty(String name)
Removes the property with the specified name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PROPERTIES
public static final String PROPERTY
Constructor Detail |
---|
public BeanIntrospector(Class<?> clazz) throws IntrospectionException
clazz
- the type of the object to be introspected.
IntrospectionException
- if the java bean introspection failedpublic BeanIntrospector(Class<?> clazz, String[] properties) throws IntrospectionException
new String[] {
"propertyName1", "propertyDescription1", "propertyCategory1",
"propertyName2", "propertyDescription2", "propertyCategory2",
...
};
clazz
- the type of the object to be introspected.properties
- a single dimension String array. See above for the format.
IntrospectionException
- if the java bean introspection failedpublic BeanIntrospector(Class<?> clazz, String[] properties, int count) throws IntrospectionException
new String[] {
"propertyName1",
"propertyName2",
...
};
If count is 2, the format will be
new String[] {
"propertyName1", "displayName11",
"propertyName2", "displayName12",
...
};
If count is 3, the format will be
new String[] {
"propertyName1", "propertyDescription1", "propertyCategory1",
"propertyName2", "propertyDescription2", "propertyCategory2",
...
};
If count is 4, the format will be
new String[] {
"propertyName1", "displayName11", "propertyDescription1", "propertyCategory1",
"propertyName2", "displayName12", "propertyDescription2", "propertyCategory2",
...
};
clazz
- the type of the object to be introspected.properties
- a single dimension String array. See above for the format.count
- the count of the attributes for each property. See above.
IntrospectionException
- if the java bean introspection failedpublic BeanIntrospector(Class<?> clazz, String[] properties, boolean filtered) throws IntrospectionException
properties
array as a filter or not.
clazz
- the type of the object to be introspected.properties
- a single dimension String array. See above for the format.filtered
- true if only properties defined in properties
array are used. Otherwise, it will
still use reflection to find all properties and add additional attributes defined in
properties
array to those properties.
IntrospectionException
- if the java bean introspection failedpublic BeanIntrospector(Class<?> clazz, String fileName) throws IntrospectionException
Possible attributes for...
Property
element are "name", "displayName", "value", "type", "description";
"dependingProperties", "category", "converterContext", "editorContext", "editable", "autoIntrospect", "expert",
"hidden" and "preferred". The only required attribute is "name". All other are optional.
clazz
- the type of the object to be introspected.fileName
- the file name
IntrospectionException
- if the java bean introspection failedpublic BeanIntrospector(Class<?> clazz, InputStream in) throws IntrospectionException
clazz
- the type of the object to be introspected.in
- the input stream
IntrospectionException
- if the java bean introspection failedfor the xml file format.
public BeanIntrospector(Class<?> clazz, BeanInfo beanInfo)
clazz
- the type of the object to be introspected.beanInfo
- the bean infoMethod Detail |
---|
public void introspectProperties(Class<?> clazz, String fileName, boolean filtered) throws IntrospectionException
clazz
- the type of the object to be introspected.fileName
- the file namefiltered
- true to use the properties defined in the file to filter the property list.
IntrospectionException
- if the java bean introspection failedpublic void introspectProperties(Class<?> clazz, InputStream in, boolean filtered) throws IntrospectionException
clazz
- the type of the object to be introspected.in
- the input streamfiltered
- true to use the properties defined in the input stream to filter the property list.
IntrospectionException
- if the java bean introspection failedprotected BeanProperty createBeanProperty(PropertyDescriptor pd)
pd
- the property descriptor
protected BeanProperty createBeanProperty(String name, Class<?> clazz)
name
- the property nameclazz
- the bean class
public PropertyTableModel<Property> createPropertyTableModel(Object beanObject)
public <T> BeanTableModel createBeanTableModel(List<T> objects)
public List<Property> createPropertyList(Object beanObject)
public int getPropertyCount()
Introspector
getPropertyCount
in interface Introspector<BeanProperty>
public BeanProperty getProperty(String name)
Introspector
getProperty
in interface Introspector<BeanProperty>
name
- the property name.
public void removeProperty(String name)
Introspector
removeProperty
in interface Introspector<BeanProperty>
name
- the property name.public void addProperty(BeanProperty property)
Introspector
addProperty
in interface Introspector<BeanProperty>
property
- a new propertypublic String[] getPropertyNames()
Introspector
getPropertyNames
in interface Introspector<BeanProperty>
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |