There are 25 code examples for java.beans.PropertyDescriptor.
The API names are highlighted below.
You can use
button
to vote the code example(s) you like. The best code example will be ranked first next time. Thanks a lot for your feedback.
Project Name: weka Package: weka.classifiers.misc
Source Code: InputMappedClassifierBeanInfo.java (Click to view .java file)
Method Code:
/**
* Get an array of PropertyDescriptors for the InputMappedClassifier's
* public properties.
* @return an array of PropertyDescriptors
*/
public PropertyDescriptor[] getPropertyDescriptors(){
try {
PropertyDescriptor p1;
ArrayList<PropertyDescriptor> pds=new ArrayList<PropertyDescriptor>();
p1=new PropertyDescriptor("modelPath",InputMappedClassifier.class);
p1.setPropertyEditorClass(weka.gui.beans.FileEnvironmentField.class);
pds.add(p1);
pds.add(new PropertyDescriptor("ignoreCaseForNames",InputMappedClassifier.class));
pds.add(new PropertyDescriptor("suppressMappingReport",InputMappedClassifier.class));
pds.add(new PropertyDescriptor("trim",InputMappedClassifier.class));
pds.add(new PropertyDescriptor("classifier",InputMappedClassifier.class));
pds.add(new PropertyDescriptor("options",InputMappedClassifier.class));
return pds.toArray(new PropertyDescriptor[1]);
}
catch ( Exception ex) {
ex.printStackTrace();
}
return null;
}
Project Name: weka Package: weka.core
Source Code: PropertyPath.java (Click to view .java file)
Method Code:
/**
* returns the property and object associated with the given path, null if
* a problem occurred.
* @param src the object to start from
* @param path the path to follow
* @return not null, if the property could be found
*/
public static PropertyContainer find(Object src,Path path){
PropertyContainer result;
PropertyDescriptor desc;
Object newSrc;
PathElement part;
Method method;
Object methodResult;
part=path.get(0);
try {
desc=new PropertyDescriptor(part.getName(),src.getClass());
}
catch ( Exception e) {
desc=null;
e.printStackTrace();
}
if (desc == null) return null;
if (path.size() == 1) {
result=new PropertyContainer(desc,src);
}
else {
try {
method=desc.getReadMethod();
methodResult=method.invoke(src,(Object[])null);
if (part.hasIndex()) newSrc=Array.get(methodResult,part.getIndex());
else newSrc=methodResult;
result=find(newSrc,path.subpath(1));
}
catch ( Exception e) {
result=null;
e.printStackTrace();
}
}
return result;
}
Project Name: weka Package: weka.core
Source Code: CheckGOE.java (Click to view .java file)
Method Code:
/**
* checks whether the object declares tip text method for all its
* properties.
* @return true if the test was passed
*/
public boolean checkToolTips(){
boolean result;
Class<?> cls;
BeanInfo info;
PropertyDescriptor[] desc;
int i;
Vector<String> missing;
String suffix;
print("Tool tips...");
result=true;
suffix="TipText";
cls=getObject().getClass();
try {
info=Introspector.getBeanInfo(cls,Object.class);
desc=info.getPropertyDescriptors();
}
catch ( Exception e) {
e.printStackTrace();
desc=null;
}
if (desc != null) {
missing=new Vector<String>();
for (i=0; i < desc.length; i++) {
if (m_IgnoredProperties.contains(desc[i].getName())) continue;
if ((desc[i].getReadMethod() == null) || (desc[i].getWriteMethod() == null)) continue;
try {
cls.getMethod(desc[i].getName() + suffix,(Class[])null);
}
catch ( Exception e) {
result=false;
missing.add(desc[i].getName() + suffix);
}
}
if (result) println("yes");
else println("no (missing: " + missing + ")");
}
else {
println("maybe");
}
return result;
}
Project Name: weka Package: weka.core.xml
Source Code: XMLSerialization.java (Click to view .java file)
Method Code:
/**
* returns a descriptor for a given objet by providing the name
* @param o the object the get the descriptor for
* @param name the display name of the descriptor
* @return the Descriptor, if found, otherwise <code>null</code>
* @throws Exception if introsepction fails
*/
protected PropertyDescriptor getDescriptorByName(Object o,String name) throws Exception {
PropertyDescriptor result;
PropertyDescriptor[] desc;
int i;
result=null;
desc=Introspector.getBeanInfo(o.getClass()).getPropertyDescriptors();
for (i=0; i < desc.length; i++) {
if (desc[i].getDisplayName().equals(name)) {
result=desc[i];
break;
}
}
return result;
}
Project Name: weka Package: weka.core.xml
Source Code: XMLSerialization.java (Click to view .java file)
Method Code:
/**
* adds the specific node to the object via a set method
* @param o the object to set a property
* @param name the name of the object for which to set a property
* (only for information reasons)
* @param child the value of the property to add
* @return the provided object, but augmented by the child
* @throws Exception if something goes wrong
*/
public Object readFromXML(Object o,String name,Element child) throws Exception {
Object result;
Hashtable descriptors;
PropertyDescriptor descriptor;
String methodName;
Method method;
Object[] methodArgs;
Object tmpResult;
Class paramClass;
result=o;
descriptors=getDescriptors(result);
methodName=child.getAttribute(ATT_NAME);
if (m_Properties.isIgnored(getPath(child))) return result;
if (m_Properties.isIgnored(result,getPath(child))) return result;
if (!m_Properties.isAllowed(result,methodName)) return result;
descriptor=(PropertyDescriptor)descriptors.get(methodName);
if (descriptor == null) {
if (!m_CustomMethods.read().contains(methodName)) System.out.println("WARNING: unknown property '" + name + "."+ methodName+ "'!");
return result;
}
method=descriptor.getWriteMethod();
methodArgs=new Object[1];
tmpResult=invokeReadFromXML(child);
paramClass=method.getParameterTypes()[0];
if (paramClass.isArray()) {
if (Array.getLength(tmpResult) == 0) return result;
methodArgs[0]=(Object[])tmpResult;
}
else {
methodArgs[0]=tmpResult;
}
method.invoke(result,methodArgs);
return result;
}
Project Name: weka Package: weka.experiment
Source Code: Experiment.java (Click to view .java file)
Method Code:
/**
* Recursively sets the custom property value, by setting all values
* along the property path.
* @param propertyDepth the current position along the property path
* @param origValue the value to set the property to
* @throws Exception if an error occurs
*/
protected void setProperty(int propertyDepth,Object origValue) throws Exception {
PropertyDescriptor current=m_PropertyPath[propertyDepth].property;
Object subVal=null;
if (propertyDepth < m_PropertyPath.length - 1) {
Method getter=current.getReadMethod();
Object getArgs[]={};
subVal=getter.invoke(origValue,getArgs);
setProperty(propertyDepth + 1,subVal);
}
else {
subVal=Array.get(m_PropertyArray,m_PropertyNumber);
}
Method setter=current.getWriteMethod();
Object[] args={subVal};
setter.invoke(origValue,args);
}
Project Name: weka Package: weka.experiment
Source Code: PropertyNode.java (Click to view .java file)
Method Code:
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
value=in.readObject();
parentClass=(Class)in.readObject();
String name=(String)in.readObject();
String getter=(String)in.readObject();
String setter=(String)in.readObject();
try {
property=new PropertyDescriptor(name,parentClass,getter,setter);
}
catch ( IntrospectionException ex) {
throw new ClassNotFoundException("Couldn't create property descriptor: " + parentClass.getName() + "::"+ name);
}
}
Project Name: weka Package: weka.experiment.xml
Source Code: XMLExperiment.java (Click to view .java file)
Method Code:
/**
* adds the given PropertyNode to a DOM structure.
* @param parent the parent of this object, e.g. the class this object is a member of
* @param o the Object to describe in XML
* @param name the name of the object
* @return the node that was created
* @throws Exception if the DOM creation fails
*/
public Element writePropertyNode(Element parent,Object o,String name) throws Exception {
Element node;
PropertyNode pnode;
Vector children;
int i;
Element child;
if (DEBUG) trace(new Throwable(),name);
m_CurrentNode=parent;
pnode=(PropertyNode)o;
node=(Element)parent.appendChild(m_Document.getDocument().createElement(TAG_OBJECT));
node.setAttribute(ATT_NAME,name);
node.setAttribute(ATT_CLASS,pnode.getClass().getName());
node.setAttribute(ATT_PRIMITIVE,VAL_NO);
node.setAttribute(ATT_ARRAY,VAL_NO);
if (pnode.value != null) invokeWriteToXML(node,pnode.value,NAME_PROPERTYNODE_VALUE);
if (pnode.parentClass != null) invokeWriteToXML(node,pnode.parentClass.getName(),NAME_PROPERTYNODE_PARENTCLASS);
if (pnode.property != null) invokeWriteToXML(node,pnode.property.getDisplayName(),NAME_PROPERTYNODE_PROPERTY);
if ((pnode.value != null) && (pnode.property != null) && (pnode.property.getPropertyType().isPrimitive())) {
children=XMLDocument.getChildTags(node);
for (i=0; i < children.size(); i++) {
child=(Element)children.get(i);
if (!child.getAttribute(ATT_NAME).equals(NAME_PROPERTYNODE_VALUE)) continue;
child.setAttribute(ATT_CLASS,pnode.property.getPropertyType().getName());
child.setAttribute(ATT_PRIMITIVE,VAL_YES);
}
}
return node;
}
Project Name: weka Package: weka.gui.beans
Source Code: TrainTestSplitMakerBeanInfo.java (Click to view .java file)
Method Code:
/**
* Get the property descriptors for this bean
* @return a <code>PropertyDescriptor[]</code> value
*/
public PropertyDescriptor[] getPropertyDescriptors(){
try {
PropertyDescriptor p1;
PropertyDescriptor p2;
p1=new PropertyDescriptor("trainPercent",TrainTestSplitMaker.class);
p2=new PropertyDescriptor("seed",TrainTestSplitMaker.class);
PropertyDescriptor[] pds={p1,p2};
return pds;
}
catch ( Exception ex) {
ex.printStackTrace();
}
return null;
}
Project Name: weka Package: weka.gui.beans
Source Code: TrainTestSplitMakerBeanInfo.java (Click to view .java file)
Method Code:
/**
* Get the property descriptors for this bean
* @return a <code>PropertyDescriptor[]</code> value
*/
public PropertyDescriptor[] getPropertyDescriptors(){
try {
PropertyDescriptor p1;
PropertyDescriptor p2;
p1=new PropertyDescriptor("trainPercent",TrainTestSplitMaker.class);
p2=new PropertyDescriptor("seed",TrainTestSplitMaker.class);
PropertyDescriptor[] pds={p1,p2};
return pds;
}
catch ( Exception ex) {
ex.printStackTrace();
}
return null;
}
Project Name: weka Package: weka.gui.beans
Source Code: ClassValuePickerBeanInfo.java (Click to view .java file)
Method Code:
/**
* Returns the property descriptors
* @return a <code>PropertyDescriptor[]</code> value
*/
public PropertyDescriptor[] getPropertyDescriptors(){
try {
PropertyDescriptor p1;
p1=new PropertyDescriptor("classValue",ClassValuePicker.class);
PropertyDescriptor[] pds={p1};
return pds;
}
catch ( Exception ex) {
ex.printStackTrace();
}
return null;
}
Project Name: weka Package: weka.gui.beans
Source Code: ClassValuePickerBeanInfo.java (Click to view .java file)
Method Code:
/**
* Returns the property descriptors
* @return a <code>PropertyDescriptor[]</code> value
*/
public PropertyDescriptor[] getPropertyDescriptors(){
try {
PropertyDescriptor p1;
p1=new PropertyDescriptor("classValue",ClassValuePicker.class);
PropertyDescriptor[] pds={p1};
return pds;
}
catch ( Exception ex) {
ex.printStackTrace();
}
return null;
}
Project Name: weka Package: weka.gui.beans
Source Code: CrossValidationFoldMakerBeanInfo.java (Click to view .java file)
Method Code:
/**
* Return the property descriptors for this bean
* @return a <code>PropertyDescriptor[]</code> value
*/
public PropertyDescriptor[] getPropertyDescriptors(){
try {
PropertyDescriptor p1;
PropertyDescriptor p2;
PropertyDescriptor p3;
p1=new PropertyDescriptor("folds",CrossValidationFoldMaker.class);
p2=new PropertyDescriptor("seed",CrossValidationFoldMaker.class);
p3=new PropertyDescriptor("preserveOrder",CrossValidationFoldMaker.class);
PropertyDescriptor[] pds={p1,p2,p3};
return pds;
}
catch ( Exception ex) {
ex.printStackTrace();
}
return null;
}
Project Name: weka Package: weka.gui.beans
Source Code: CrossValidationFoldMakerBeanInfo.java (Click to view .java file)
Method Code:
/**
* Return the property descriptors for this bean
* @return a <code>PropertyDescriptor[]</code> value
*/
public PropertyDescriptor[] getPropertyDescriptors(){
try {
PropertyDescriptor p1;
PropertyDescriptor p2;
PropertyDescriptor p3;
p1=new PropertyDescriptor("folds",CrossValidationFoldMaker.class);
p2=new PropertyDescriptor("seed",CrossValidationFoldMaker.class);
p3=new PropertyDescriptor("preserveOrder",CrossValidationFoldMaker.class);
PropertyDescriptor[] pds={p1,p2,p3};
return pds;
}
catch ( Exception ex) {
ex.printStackTrace();
}
return null;
}
Project Name: weka Package: weka.gui.beans
Source Code: IncrementalClassifierEvaluatorBeanInfo.java (Click to view .java file)
Method Code:
/**
* Return the property descriptors for this bean
* @return a <code>PropertyDescriptor[]</code> value
*/
public PropertyDescriptor[] getPropertyDescriptors(){
try {
PropertyDescriptor p1;
PropertyDescriptor p2;
PropertyDescriptor p3;
p1=new PropertyDescriptor("statusFrequency",IncrementalClassifierEvaluator.class);
p2=new PropertyDescriptor("outputPerClassInfoRetrievalStats",IncrementalClassifierEvaluator.class);
p3=new PropertyDescriptor("chartingEvalWindowSize",IncrementalClassifierEvaluator.class);
PropertyDescriptor[] pds={p1,p2,p3};
return pds;
}
catch ( Exception ex) {
ex.printStackTrace();
}
return null;
}
Project Name: weka Package: weka.gui.beans
Source Code: IncrementalClassifierEvaluatorBeanInfo.java (Click to view .java file)
Method Code:
/**
* Return the property descriptors for this bean
* @return a <code>PropertyDescriptor[]</code> value
*/
public PropertyDescriptor[] getPropertyDescriptors(){
try {
PropertyDescriptor p1;
PropertyDescriptor p2;
PropertyDescriptor p3;
p1=new PropertyDescriptor("statusFrequency",IncrementalClassifierEvaluator.class);
p2=new PropertyDescriptor("outputPerClassInfoRetrievalStats",IncrementalClassifierEvaluator.class);
p3=new PropertyDescriptor("chartingEvalWindowSize",IncrementalClassifierEvaluator.class);
PropertyDescriptor[] pds={p1,p2,p3};
return pds;
}
catch ( Exception ex) {
ex.printStackTrace();
}
return null;
}
Project Name: weka Package: weka.gui.beans
Source Code: PredictionAppenderBeanInfo.java (Click to view .java file)
Method Code:
/**
* Return the property descriptors for this bean
* @return a <code>PropertyDescriptor[]</code> value
*/
public PropertyDescriptor[] getPropertyDescriptors(){
try {
PropertyDescriptor p1;
p1=new PropertyDescriptor("appendPredictedProbabilities",PredictionAppender.class);
PropertyDescriptor[] pds={p1};
return pds;
}
catch ( Exception ex) {
ex.printStackTrace();
}
return null;
}
Project Name: weka Package: weka.gui.beans
Source Code: PredictionAppenderBeanInfo.java (Click to view .java file)
Method Code:
/**
* Return the property descriptors for this bean
* @return a <code>PropertyDescriptor[]</code> value
*/
public PropertyDescriptor[] getPropertyDescriptors(){
try {
PropertyDescriptor p1;
p1=new PropertyDescriptor("appendPredictedProbabilities",PredictionAppender.class);
PropertyDescriptor[] pds={p1};
return pds;
}
catch ( Exception ex) {
ex.printStackTrace();
}
return null;
}
Project Name: weka Package: weka.gui.beans
Source Code: ClassifierPerformanceEvaluatorBeanInfo.java (Click to view .java file)
Method Code:
/**
* Get the property descriptors for this bean
* @return a <code>PropertyDescriptor[]</code> value
*/
public PropertyDescriptor[] getPropertyDescriptors(){
try {
PropertyDescriptor p1;
p1=new PropertyDescriptor("executionSlots",ClassifierPerformanceEvaluator.class);
PropertyDescriptor[] pds={p1};
return pds;
}
catch ( Exception ex) {
ex.printStackTrace();
}
return null;
}
Project Name: weka Package: weka.gui.beans
Source Code: ClassifierPerformanceEvaluatorBeanInfo.java (Click to view .java file)
Method Code:
/**
* Get the property descriptors for this bean
* @return a <code>PropertyDescriptor[]</code> value
*/
public PropertyDescriptor[] getPropertyDescriptors(){
try {
PropertyDescriptor p1;
p1=new PropertyDescriptor("executionSlots",ClassifierPerformanceEvaluator.class);
PropertyDescriptor[] pds={p1};
return pds;
}
catch ( Exception ex) {
ex.printStackTrace();
}
return null;
}
Project Name: weka Package: weka.gui.beans
Source Code: StripChartBeanInfo.java (Click to view .java file)
Method Code:
/**
* Get the property descriptors for this bean
* @return a <code>PropertyDescriptor[]</code> value
*/
public PropertyDescriptor[] getPropertyDescriptors(){
try {
PropertyDescriptor p1;
PropertyDescriptor p2;
p1=new PropertyDescriptor("xLabelFreq",StripChart.class);
p2=new PropertyDescriptor("refreshFreq",StripChart.class);
PropertyDescriptor[] pds={p1,p2};
return pds;
}
catch ( Exception ex) {
ex.printStackTrace();
}
return null;
}
Project Name: weka Package: weka.gui.beans
Source Code: StripChartBeanInfo.java (Click to view .java file)
Method Code:
/**
* Get the property descriptors for this bean
* @return a <code>PropertyDescriptor[]</code> value
*/
public PropertyDescriptor[] getPropertyDescriptors(){
try {
PropertyDescriptor p1;
PropertyDescriptor p2;
p1=new PropertyDescriptor("xLabelFreq",StripChart.class);
p2=new PropertyDescriptor("refreshFreq",StripChart.class);
PropertyDescriptor[] pds={p1,p2};
return pds;
}
catch ( Exception ex) {
ex.printStackTrace();
}
return null;
}
Project Name: weka Package: weka.gui.beans
Source Code: ClassAssignerBeanInfo.java (Click to view .java file)
Method Code:
/**
* Returns the property descriptors
* @return a <code>PropertyDescriptor[]</code> value
*/
public PropertyDescriptor[] getPropertyDescriptors(){
try {
PropertyDescriptor p1;
p1=new PropertyDescriptor("classColumn",ClassAssigner.class);
PropertyDescriptor[] pds={p1};
return pds;
}
catch ( Exception ex) {
ex.printStackTrace();
}
return null;
}
Project Name: weka Package: weka.gui.beans
Source Code: ClassAssignerBeanInfo.java (Click to view .java file)
Method Code:
/**
* Returns the property descriptors
* @return a <code>PropertyDescriptor[]</code> value
*/
public PropertyDescriptor[] getPropertyDescriptors(){
try {
PropertyDescriptor p1;
p1=new PropertyDescriptor("classColumn",ClassAssigner.class);
PropertyDescriptor[] pds={p1};
return pds;
}
catch ( Exception ex) {
ex.printStackTrace();
}
return null;
}
Project Name: weka Package: weka.gui.experiment
Source Code: GeneratorPropertyIteratorPanel.java (Click to view .java file)
Method Code:
/**
* Gets the user to select a property of the current resultproducer.
* @return APPROVE_OPTION if the selection went OK, otherwise the selection
* was cancelled.
*/
protected int selectProperty(){
final PropertySelectorDialog jd=new PropertySelectorDialog(null,m_Exp.getResultProducer());
jd.setLocationRelativeTo(this);
int result=jd.showDialog();
if (result == PropertySelectorDialog.APPROVE_OPTION) {
System.err.println("Property Selected");
PropertyNode[] path=jd.getPath();
Object value=path[path.length - 1].value;
PropertyDescriptor property=path[path.length - 1].property;
Class propertyClass=property.getPropertyType();
m_Exp.setPropertyPath(path);
m_Exp.setPropertyArray(Array.newInstance(propertyClass,1));
Array.set(m_Exp.getPropertyArray(),0,value);
m_ArrayEditor.setValue(m_Exp.getPropertyArray());
m_ArrayEditor.repaint();
System.err.println("Set new array to array editor");
}
else {
System.err.println("Cancelled");
}
return result;
}