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