Interface IAdornmentProvider

All Known Implementing Classes:
AllValidAdornments, LazyPlanningAdornments

public interface IAdornmentProvider
An adornment provider is used to define the adornments the pattern matcher should prepare for.

A default implementation is available in AllValidAdornments that describes all adornments fulfilling the parameter direction declarations; another default option (with better performance but restricted applicability) is LazyPlanningAdornments.

Users may implement this interface to limit the number of prepared plans based on some runtime information:

 class SomeAdornments{

     public Iterable<Set<PParameter>> getAdornments(PQuery query){
         if (SomeGeneratedQuerySpecification.instance().getInternalQueryRepresentation().equals(query)){
             return Collections.singleton(Sets.filter(Sets.newHashSet(query.getParameters()), new Predicate() {

                  @Override
                  public boolean apply(PParameter input) {
                      // Decide whether this particular parameter will be bound
                      return false;
                  }
              }));
         }
         // Returning an empty iterable is safe for unknown queries
         return Collections.emptySet();
     }

 }
 
Since:
1.5