Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [tigerstripe-dev] Re: Annotations and Generation

So some code...
 

public List<ParsedOcl> getOclConstraint() throws TigerstripeException{

String ocl = (String) this.component.getAnnotation(DEFAULT_SCHEME, OCL_ANNOTATION);

if (ocl == null)

return null;

List<ParsedOcl> out = null;

try {

OclTranslator translator = new TranslatorImpl(ocl);

out = translator.asList();

} catch (OclValidationError e) {

throw new TigerstripeException("OCL Validation error:"+e.getLocalizedMessage());

}

return out;

}

Where ...

private static final String OCL_ANNOTATION = "org.eclipse.tigerstripe.annotations.samples.bigStringAnnotationSpecification1";

private static final String VERSION_ANNOTATION = "org.eclipse.tigerstripe.annotations.samples.annotations.version";

private static final String DEFAULT_SCHEME = "org.eclipse.tigerstripe.annotations.samples.scheme.default";



From: tigerstripe-dev-bounces@xxxxxxxxxxx [mailto:tigerstripe-dev-bounces@xxxxxxxxxxx] On Behalf Of Eric Dillon (erdillon)
Sent: Wednesday, March 26, 2008 9:18 AM
To: John Worrell (jworrell)
Cc: tigerstripe-dev@xxxxxxxxxxx
Subject: [tigerstripe-dev] Re: Annotations and Generation

Hi John,

I am ashamed... I forgot about your email. Apologies. (the truth is... Steve probably knew)... so using the tigerstripe-dev@xxxxxxxxxxx... could have helped here ;-)

The current mechanism is very rudimentary, but allows to get the value of the annotation based on two keys that would identify it completely.
So on any IArtifactComponent (artifacts, methods, attributes, etc..), you can do:

$artifact.getAnnotation( "<schemeID>", "<annotationSpecId>")

both IDs are the strings defined in your Annotation extension point. This will return a String containing the value or null if no value.

Eric 


On Mar 26, 2008, at 8:12 AM, John Worrell (jworrell) wrote:
Thanks richard...
 
Hi jim / Eric... any pointers?
 
Thanks,
 
JohnW


From: Richard Craddock (rcraddoc)
Sent: 26 March 2008 15:14
To: John Worrell (jworrell)
Cc: Duncan Keysell (dkeysell); Eric Dillon (erdillon); Jim Strawn (jistrawn)
Subject: RE: Annotations and Generation

John,
 
sorry I had to go out for bit.
 
Err.. Well no - I have not played with the new stuff as yet!
 
Eric, Jim might be able to shed some light
 
RC
 


From: John Worrell (jworrell)
Sent: 26 March 2008 13:45
To: Richard Craddock (rcraddoc); Duncan Keysell (dkeysell)
Subject: RE: Annotations and Generation

Any ideas?
 
Thanks,
 
JohnW


From: John Worrell (jworrell)
Sent: 26 March 2008 12:24
To: Richard Craddock (rcraddoc); Duncan Keysell (dkeysell)
Subject: RE: Annotations and Generation

The new stuff - I have been using the existing ones happily for a good while now.
 
Thanks,
 
JohNW


From: Richard Craddock (rcraddoc)
Sent: 26 March 2008 11:59
To: John Worrell (jworrell); Duncan Keysell (dkeysell)
Subject: RE: Annotations and Generation

Are you talking new OS - style annotations, or the stereotypes we had before?
 
 


From: John Worrell (jworrell)
Sent: 26 March 2008 11:54
To: Richard Craddock (rcraddoc); Duncan Keysell (dkeysell)
Subject: FW: Annotations and Generation

Hi Richard / Duncan,
 
Are you able to help?
 
Thanks,
 
JohNW


From: John Worrell (jworrell)
Sent: 22 March 2008 11:49
To: Eric Dillon (erdillon)
Subject: Annotations and Generation

Hi Eric,
 
Could you point me to where I access the annotations when I am in a generation plugin, please? Been hunting and had no joy so far.
 
Thanks,
 
JohnW


Back to the top