You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by storck <di...@cms.tecmath.de> on 2001/09/20 12:16:57 UTC

org.apache.commons.beanutils.PropertyUtil

Hi,

I would like to use the PropertyUtil-class from
"org.apache.commons.beanutils" to copy the properties from one bean to
another.
For Example I have a bean bVO from type BBDetailVO and I have a bean bForm
from type ShowBlackBoardDetailsForm
If I do something like
	PropertyUtil.copyProperties(bVO, bForm);
I get an IllegalArgumentException and if I do something like
	PropertyUtil.copyProperties(bForm, bVO);
I get "NoSuchMethodException: Property 'pk' has no getter method"

Could you please HELP me !!!

If I use two normal beans mit 3 or 4 propeties and use the
PropertyUtil-class everything workes fine..

THANKS!!!!




package de.tecmath.cms.ejb.BlackBoard.valueobjects;

import de.tecmath.cms.ejb.BlackBoard.entity.bean.BlackBoardBean;
import de.tecmath.cms.util.ejb.valueobjectfactory.exception.*;
import javax.ejb.*;
import de.tecmath.cms.ejb.BlackBoard.entity.interfaces.*;
import de.tecmath.cms.util.ejb.valueobjectfactory.*;
import java.io.*;
import de.tecmath.cms.util.ejb.valueobject.*;
/**
 * Insert the type's description here.
 * Creation date: (30.08.2001 14:54:56)
 * @author:
 */
public class BBDetailVO extends ValueObjectAdapter implements
BlackBoardBusiness, Serializable {
	private java.lang.String name = null;
	private java.lang.String content = null;
	private java.lang.Integer pk = null;

/**
 * BBDetailVO constructor comment.
 */
public BBDetailVO() {
	super();
	super.setOverWriteable(false);
}
/**
 * BBDetailVO constructor comment.
 */
public BBDetailVO(Integer pk, String name, String content) {
	super();
	this.pk = pk;
	this.name = name;
	this.content = content;
	super.setOverWriteable(false);
}
/**
 * Insert the method's description here.
 * Creation date: (30.08.2001 14:54:56)
 * @param source java.lang.Object
 * @exception de.tecmath.cms.util.ejb.valueobjectfactory.VOFillingError The
exception description.
 */
public void fill(Object source)
	throws de.tecmath.cms.util.ejb.valueobjectfactory.exception.VOFillingError
{
	try {
		if (source instanceof BlackBoardBean) {
			BlackBoardBean bb = (BlackBoardBean) source;
			this.pk = bb.getPk();
			this.name = bb.getName();
			this.content = bb.getContent();
			this.setModCounter(bb.getModCounter());
		} else
			throw new VOFillingError();
	} catch (java.rmi.RemoteException re) {
		throw new VOFillingError(
			"RemoteException occured in fill(). Reason: " + re.getMessage());
	}
}
/**
 * Insert the method's description here.
 * Creation date: (30.08.2001 14:55:38)
 * @return java.lang.String
 */
public java.lang.String getContent() {
	return content;
}
/**
 * Insert the method's description here.
 * Creation date: (30.08.2001 14:55:23)
 * @return java.lang.String
 */
public java.lang.String getName() {
	return name;
}
/**
 * Insert the method's description here.
 * Creation date: (30.08.2001 14:55:56)
 * @return java.lang.Integer
 */
public java.lang.Integer getPk() {
	return pk;
}
/**
 * Insert the method's description here.
 * Creation date: (31.08.2001 14:23:43)
 * @return java.lang.String
 */
public String getValueObjectName() {
	return "BBDetailVO";
}
/**
 * Insert the method's description here.
 * Creation date: (30.08.2001 14:55:38)
 * @param newContent java.lang.String
 */
public void setContent(java.lang.String newContent) {
	content = newContent;
}
/**
 * Insert the method's description here.
 * Creation date: (30.08.2001 14:55:23)
 * @param newName java.lang.String
 */
public void setName(java.lang.String newName) {
	name = newName;
}
/**
 * Insert the method's description here.
 * Creation date: (30.08.2001 14:55:56)
 * @param newPk java.lang.Integer
 */
public void setPk(java.lang.Integer newPk) {
	pk = newPk;
}
/**
 * Insert the method's description here.
 * Creation date: (30.08.2001 14:55:56)
 * @param newPk java.lang.Integer
 */
public void setPk(String newPk) {
	if(newPk != null && newPk.length() >0) {
		pk = new Integer(newPk);
	}
}
/**
 * Insert the method's description here.
 * Creation date: (31.08.2001 14:41:16)
 * @return java.lang.String
 */
public String toString() {
	StringBuffer buffer = new StringBuffer();
	buffer.append("PK: "+this.getPk());
	buffer.append("\n");
	buffer.append("Name: "+this.getName());
	buffer.append("\n");
	buffer.append("Content: "+this.getContent());
	buffer.append("\n");
	buffer.append("ModCounter: "+this.getModCounter());
	buffer.append("\n");
	return buffer.toString();
}
}

_______________________________________________
package de.tecmath.cms.ejb.BlackBoard.struts;

import de.tecmath.cms.ejb.BlackBoard.valueobjects.*;
/**
 * Insert the type's description here.
 * Creation date: (19.09.2001 10:22:42)
 * @author:
 */
public class ShowBlackBoardDetailsForm extends
org.apache.struts.action.ActionForm {
	private java.lang.String action;
	private java.lang.Integer pk;
	private java.lang.String name;
	private java.lang.String content;
	private java.lang.Long modCount;
	private boolean overWriteable;
	private java.lang.String submit;
/**
 * Insert the method's description here.
 * Creation date: (19.09.2001 11:25:08)
 * @return java.lang.String
 */
public java.lang.String getAction() {
	return action;
}
/**
 * Insert the method's description here.
 * Creation date: (19.09.2001 14:23:47)
 * @return java.lang.String
 */
public java.lang.String getContent() {
	return content;
}
/**
 * Insert the method's description here.
 * Creation date: (19.09.2001 15:18:02)
 * @return java.lang.Long
 */
public java.lang.Long getModCount() {
	return modCount;
}
/**
 * Insert the method's description here.
 * Creation date: (19.09.2001 14:23:36)
 * @return java.lang.String
 */
public java.lang.String getName() {
	return name;
}
/**
 * Insert the method's description here.
 * Creation date: (19.09.2001 16:31:15)
 * @return java.lang.Integer
 */
public java.lang.Integer getPk() {
	return pk;
}
/**
 * Insert the method's description here.
 * Creation date: (19.09.2001 16:03:41)
 * @return java.lang.String
 */
public java.lang.String getSubmit() {
	return submit;
}
/**
 * Insert the method's description here.
 * Creation date: (19.09.2001 15:41:02)
 * @return boolean
 */
public boolean isOverWriteable() {
	return overWriteable;
}
/**
 * Insert the method's description here.
 * Creation date: (19.09.2001 11:25:08)
 * @param newAction java.lang.String
 */
public void setAction(java.lang.String newAction) {
	action = newAction;
}
/**
 * Insert the method's description here.
 * Creation date: (19.09.2001 14:23:47)
 * @param newContent java.lang.String
 */
public void setContent(java.lang.String newContent) {
	content = newContent;
}
/**
 * Insert the method's description here.
 * Creation date: (19.09.2001 15:18:02)
 * @param newModCount java.lang.Long
 */
public void setModCount(java.lang.Long newModCount) {
	modCount = newModCount;
}
/**
 * Insert the method's description here.
 * Creation date: (19.09.2001 14:23:36)
 * @param newName java.lang.String
 */
public void setName(java.lang.String newName) {
	name = newName;
}
/**
 * Insert the method's description here.
 * Creation date: (19.09.2001 15:41:02)
 * @param newOverWriteable boolean
 */
public void setOverWriteable(boolean newOverWriteable) {
	overWriteable = newOverWriteable;
}
/**
 * Insert the method's description here.
 * Creation date: (19.09.2001 16:31:15)
 * @param newPk java.lang.Integer
 */
public void setPk(java.lang.Integer newPk) {
	pk = newPk;
}
/**
 * Insert the method's description here.
 * Creation date: (19.09.2001 16:03:41)
 * @param newSubmit java.lang.String
 */
public void setSubmit(java.lang.String newSubmit) {
	submit = newSubmit;
}

}