Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Specifying non-empty model attributes
Specifying non-empty model attributes [message #414369] Fri, 02 November 2007 17:37 Go to next message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3070
Registered: July 2009
Senior Member
Is it possible, in the .ecore editor, to specify that a String
attribute's value must be non-empty? I can set Required=true but that
still allows empty string and strings that only contain whitespace.
Do I have to use OCL for this?

TIA,
Eric
Re: Specifying non-empty model attributes [message #414372 is a reply to message #414369] Fri, 02 November 2007 18:51 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
Eric,

In XML Schema it's possible to specify a minLength facet (constraint) on
a simple type definition that restricts xsd:string. Such a data type
will map to an EDataType with the necessary ExtendedMetaData annotations
that will drive the validator to complain if the string is not at least
of that length. So you could create an EDataType to wrap EString, with
exactly those same annotations to get that same result. Or you could
define a named constraint on the feature's containing class and write
the code to do the validation in the generated validator...


Eric Rizzo wrote:
> Is it possible, in the .ecore editor, to specify that a String
> attribute's value must be non-empty? I can set Required=true but that
> still allows empty string and strings that only contain whitespace.
> Do I have to use OCL for this?
>
> TIA,
> Eric


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:How to use EStore?
Next Topic:Display multiple property as children
Goto Forum:
  


Current Time: Tue Apr 16 04:45:31 GMT 2024

Powered by FUDForum. Page generated in 0.46687 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top