Hi John,

the way to do this is by using the PropertyValidationRule or AbstractValidationRule classes. These contain a getBean() method that gives you access to the bean that's being validated by the rule.

Alternatively if you meta data class extends MetaData you can use retrieveValidatedBean(). Otherwise, you can implement the MetaDataBeanAware interface and the setMetaDataBean method to store the bean instance in a member variable.

Hope this help,

Geert

Geert,

I am just trying to set up validation rules in activateMetaData,
rules which reference members of the Bean itself. If you were to
pull out the Meta from your Movie class in rifers, into a
MovieMetaData class, I think you would see what I mean. When the
Bean IS the MetaData, no problem. But pull them apart and the Meta
doesn't know about the object it annotates. And I do want to keep my
beans as pojos.

- JT

>On 16 Jun 2006, at 17:44, John T wrote:

>> From a MetaData instance, how does one reference the Bean
>> instance? For
> example, to add a validation rule that relies on the values of
> fields via the
> getters.
>
> It seems to me that MetaData should have at least a way to get the
> Object:
> public final Object getMetaDataBean() {
> return mMetaDataBean;
> }
>
> ...or maybe there is a way to make it typed with Generics, I am not
> sure how
> the ClassLoader puts it together.
>
> Is there some other way that I am missing? Oh, I'll be switching
> to M2
> shortly, so if something is in there for this... nevermind.
>
> - JT
>
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

--
Geert Bevin
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com


_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to