OK, I committed the fix last night.

I did give you a bad steer there... the getAssociations() is empty when
FacetFactory#processClassContext(...) is called because of an ordering
issue.

The fix I chose was to install the DisabledObjectFacet on the ObjectSpec,
and then to additionally have the FacetFactory process the method contexts.
 Here I copy the facet down onto the member.

I did this for HiddenObjectFacet, and also (since I noticed a todo) did
something similar for ImmutableFacet.  Note that I didn't change your
modification for ImmutableFacet only applying to properties/collections;
seemed reasonable to me.

Cheers
Dan

On 6 December 2011 10:01, Dan Haywood <[email protected]> wrote:

> Hi Kevin,
> Had a look at this this morning... and have a fix.  At client site at the
> mo so can't commit, will do this eve with more detail.
> Dan
>
>
> On 5 December 2011 18:23, Kevin Meyer - KMZ <[email protected]> wrote:
>
>> Hi Dan,
>>
>> Thanks for the update. But I still can't get it to work:
>> If you load DisabledObjectViaDisabledMethodFacetFactory, you'll see
>> various attempts in "process" and "addFacetToFacetHolder" (likewise
>> for HiddenObjectViaHiddenMethodFacetFactory).
>>
>> With
>>        ObjectSpecification spec =
>> getSpecificationLookup().loadSpecification(cls);
>>        List<ObjectAssociation> members = spec.getAssociations();
>>
>> members turns out to be empty every time!
>>
>> With
>>         Method methods[] = cls.getMethods();
>>        for (Method method : methods)
>>                 FacetUtil.addFacet(new
>> DisabledObjectFacetViaDisabledMethod(method, member));
>>
>> it doesn't matter which facet I install, its never called.
>>
>> So I have gone back to hacking the HTML viewer to manually looking
>> for DisabledObjectFacet in ObjectView. Naturally, it means the other
>> viewers are oblivious.
>>
>> Regards,
>> Kevin
>>
>>
>> On 5 Dec 2011 at 11:06, Dan Haywood wrote:
>>
>> > Hi Kevin,
>> >
>> > bit rushed to reply in more detail, but the method you need is
>> > getAssociations() (which is inherited by ObjectSpecification from the
>> > superinterface, ObjectAssociationContainer).
>> >
>> > HTH
>> > Dan
>> >
>> >
>> >
>> > Sorry to give you the wrong steer there.
>> >
>> > On 5 December 2011 10:06, Kevin Meyer - KMZ <[email protected]> wrote:
>> >
>> > > Hi Dan,
>> > >
>> > > I'm trying to implement your alternate suggestion, but I'm having
>> > > issues.
>> > >
>> > > On 3 Dec 2011 at 7:03, Dan Haywood wrote:
>> > >
>> > > > final Method method =
>> > > >     MethodFinderUtils.findMethod(cls, MethodScope.OBJECT,
>> > > DISABLED_PREFIX,
>> > > > String.class, NO_PARAMETERS_TYPES);
>> > > >
>> > > > for(ObjectMember member: objectSpec.getMembers()) {
>> > >
>> > > No such method as getMembers() on ObjectSpecification.
>> > >
>> > > >   FacetUtil.addFacet(new
>> DisabledObjectFacetViaDisabledMethod(method,
>> > > > member);
>> > > > }
>> > >
>> > > In fact, there is no such method anywhere except in the json applib.
>> > >
>> > > I'm trying to fetch ObjectMember based on Method... but that's not
>> > > looking good either! :)
>> > >
>> > > I understand what you're suggesting, I'm just having difficulties
>> making
>> > > it so!
>> > >
>> > > Regards,
>> > > Kevin
>>
>>
>

Reply via email to