commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frost, Gary [IT]" <Gary.Fr...@citigroup.com>
Subject [BeanUtils] how to determine whether a class has a [nested] metho d
Date Tue, 15 Apr 2003 07:31:16 GMT
Hi,

I've started looking at using beanUtils, specifically
PropertyUtil.getProperty(someObject, someNestedString);

I was wondering whether there is the facility in the utils to determine
whether for a given class object (not instance) the nested method string is
valid.. That is if I have
public class SomeBean
	{
	private SubBean subBean;
	public SubBean getSubBean() { return subBean; }
	public void setSubBean(SubBean subBean) { this.subBean = subBean; }
	}
And
public class SubBean
	{
	private Integer someInteger;
	public Integer getSomeInteger() { return someInteger; }
	public void setSomeInteger(Integer someInteger) { this.someInteger =
someInteger; }
	}

I understand that for an *instance* of SomeBean, that the Integer anInt =
(Integer)PropertyUtil.getProperty(someInstance, "subBean.someInteger"); gets
me the appropriate value from, lovely, I mean really really handy stuff..

Now the question is, is it possible form me to determine (upfront without an
instance os SomeBean) whether subBean.someInteger is valid.. i.e. something
like boolean hasMethod = PropertyUtil.hasMethod(SomeBean.class,
"subBean.someInteger");



Gary Frost
Programmer Analyst
CitiTech
Level 11, 2 Park Street
Sydney NSW Australia 2000

Phone: 		(+612) 82251572
Email: 		gary.frost@citigroup.com


Important  Information

This message may contain confidential or proprietary information.  If you
are not the intended recipient, please notify the sender immediately and
delete the message from your system.  You should not copy or use it for any
purpose, nor disclose its contents to any other person.  E-mail transmission
cannot be guaranteed to be secure or error-free.  No guarantee is made that
any attachments are virus free.  We reserve the right to monitor all e-mail
communications.

This e-mail does not take into account your investment objectives or
financial situation and you should obtain advice based on your own
individual circumstances before making an investment decision

This e-mail is made available to you in Australia by Citigroup Global
Markets Australia Pty Limited ABN 64 003 114 832, a licensed securities
dealer and futures broker, a Participating Organisation of the Australian
Stock Exchange Limited and a participant of the Sydney Futures Exchange
Limited.  In New Zealand it is made available through Citigroup Global
Markets New Zealand Limited, a member firm of the New Zealand Stock
Exchange.

Although the information is believed to be reliable, we do not guarantee its
accuracy and it may be incomplete or condensed.  All opinions and estimates
constitute Citigroup's judgement at the date of issue and are subject to
change without notice. Unless stated otherwise, pricing information is
indicative only, subject to change and is not an offer to deal at any price
quoted.  Any reference to the terms of executed transactions is preliminary
only and subject to written confirmation.



Mime
View raw message