You probably need to add

    @Retention(RetentionPolicy.RUNTIME)

to your annotation definition so that it doesn't get stripped after
compilation.  It's kind of lame that they don't mention this any place
obvious in the documentation.

Tom

On Fri, Aug 1, 2008 at 6:40 AM, Bob Tarling <[EMAIL PROTECTED]> wrote:
> I can't seem to get instanceof or isAnnotationPresent to detect a
> class annotation even though I've seen isAnnotationPresent documented
> for this purpose. I'm using JRE1.6.0_05 on Vista.
>
> So I'll leave as a simple marker interface for now, I'd be curious if
> anyone else has any success with annotations.
>
> I'll move the interface to kernel.
>
> Bob
>
>
> 2008/8/1 Tom Morris <[EMAIL PROTECTED]>:
>> I suspect that something along the lines of
>>
>>            if (o.getClass().isAnnotationPresent(UmlModelMutator.class)) {
>>
>> will do what you want, but that seems a lot more long winded than
>>
>>           (if o instanceof UmlModelMutator)
>>
>> I don't really understand why this is part of the Model API though.
>> Isn't this to do with GUI actions?  The Model subsystems neither
>> understand nor act on this marker interface.
>>
>> Tom
>>
>> On Thu, Jul 31, 2008 at 10:25 PM, Bob Tarling <[EMAIL PROTECTED]> wrote:
>>> I had some trouble detecting annotations. See the commented out code
>>> in ActionList and UmlModelMutator.
>>>
>>> If someone can correct whatever I've missed to get that working I'd be 
>>> grateful.
>>>
>>> I'm not sure that it really matters though. Annotations of a class
>>> doesn't appear to add much benefit over a marker interface in this
>>> case.
>>>
>>> Bob.
>>>
>>>
>>> 2008/7/31 Luis Sergio Oliveira <[EMAIL PROTECTED]>:
>>>> +1 for all proposals - good design idea and nice use of new features of
>>>> Java.
>>>>
>>>> Luís
>>>>
>>>> Bob Tarling wrote:
>>>>>
>>>>> I propose to resolve issues 5268 5271 by introducing a UmlModelMutator
>>>>> marker interface (it will have no methods).
>>>>>
>>>>> The collection of actions returned by getPopupActions can be amended
>>>>> to remove any Actions that implement this interface if the model
>>>>> element is readonly.
>>>>>
>>>>> Similarly the toolbar builder in the proppanels can do the same.
>>>>>
>>>>> I'm considering whether to use java 5 style annotations for this. It
>>>>> is a first for us I think to make use of this feature.
>>>>>
>>>>> So that would be
>>>>>
>>>>> public @interface UmlModelMutator {
>>>>> }
>>>>>
>>>>> and the relevant Actions annotated as @UmlModelMutator
>>>>>
>>>>> Does this seem reasonable?
>>>>>
>>>>> As this is very much related to the UML model should we have this
>>>>> defined in the model interface?
>>>>>
>>>>> Bob.
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to