Recent Changes - Search:


SourceForge Logo









YourKit Java Profiler

FacetLookupAlgorithm

Description of the Facet Lookup Algorithm

This page describes the algorithm for retrievement of facets. It explains how JFacets traverses both the profiles and target types graphs in order to find the facet you ask for.

This is what happens when the JFacets.getFacet(...) (or JFacets.execFacet(...)) are invoked, at run-time.

In order to use facets, you provide the following input parameters :

  • name : the name of the facet to be retrieved ;
  • profileId : the ID of the requesting profile ;
  • targetObject : the target object to be used.

and optionally :

  • targetObjectClass : the target object's type to be used, in you need nullable targetObjects.

These 4 parameters allow JFacets to reconstruct the (name, profile, targetObjectType) key used for assigning the facet.

It goes like :

  • try to find a facet descriptor for passed (name, profileId, targetObjectClass) key without handling parents
    • if found, then create and return the facet (execepted if it's an instance facet which doesn't match : in this case it's skipped)
    • if NOT found, then recurse and try for the supertypes of targetObjectClass
      • if descriptor found for a super type (e.g. (name, profileId, superType)), then create and return the facet
      • if NOT found for a super type, then recurse and try for super profiles

As you can see, JFacets simply goes up in the two graphs recursively, and tries to find a facet descriptor in there. Type inheritance is checked before profile inheritance.

Edit - History - Print - Recent Changes - Search
Page last modified on May 11, 2007, at 07:50 AM