Discussion:
[mdr-users] Attribute assignment validation
Viviana Cerrutti
2007-11-21 18:32:27 UTC
Permalink
Hi,

I need to do some checking on some attributes i assigned to my mof
classes. For example, i have a class named Project. I created a datatype
named Date with an alias stereotype for Primitives.Long. Project has an
attribute of this type.

I want to implement something that whenever i set an attribute of type
Date, like:

ProjectClass pClass = metaPackage.getProject();
Project p = pClass.createProject();
p.setDate(1);

i can validate the value i am assigning (in this case i should raise an
exception, since 1 is not a valid date).

I know i can implement the method setDate in ProjectImpl, but i want to
know if i can generalize it to the dataType and not the attribute in the
class.

I read something about some methods:
protected void _interceptPreSet(String featureName, Object newValue) {
}
protected void _interceptPostSet(boolean fail) {
}

But i don't know if this solves my problem, in fact, i don't know how
to use this infomation at all.

Any hints?

Viviana

---------------------------------------------------------------------------------------------------------------------------------------

La informaci�n contenida en este mensaje es para uso exclusivo del destinatario y dem�s autorizados a recibirla. Si usted ha recibido este e-mail por error, comun�quelo inmediatamente por esta v�a y elim�nelo de su sistema. Si Ud. no es el destinatario especificado en el mensaje, cualquier revelaci�n, copia o distribuci�n de su contenido est� estrictamente prohibido.
El mensaje expresa la opini�n de su autor pero no necesariamente expresa la opini�n oficial del Banco Central del Uruguay.

The information included on this message is intended only for the personal and confidential use of the designated recipient(s) named above. If you have received it by mistake please let us know by e-mail immediately and destroy or delete it from your files or system. If you are not the designated recipient, any disclose, copy or distribution of its contents is prohibited.
<<>>

Loading...