Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.ibm.workplace.wcm.api.query
Class Negation

    java.lang.Object
      com.ibm.workplace.wcm.api.query.Negation

All Implemented Interfaces:
  QueryElement, Selector, java.io.Serializable

    public final class Negation

extends java.lang.Object
implements Selector

`Negation` inverts a selector. Note that Negation may prevent the database from efficiently using indexes and therefore may perform slowly. It should therefore only be used if necessary. Example use of `Negation` with `Conjunction` and `Disjunction`

      Query query = queryService.createQuery(Content.class);
      Disjunction or = new Disjunction();
      or.add(Selectors.nameLike("news%"));
      Negation not = new Negation(ProfileSelectors.keywordsContain("news"));
      Conjunction and = new Conjunction();
      and.add(Selectors.nameLike("article%"));
      and.add(not);
      or.add(and);
      query.addSelector(or);

Since:
  8.0
See Also:
  Serialized Form

Field Summary

Fields inherited from interface com.ibm.workplace.wcm.api.query.Selector
`NULL_SELECTOR`

Constructor Summary
`Negation()` Constructor
`Negation(Selector selector)` Constructor

Method Summary
`java.util.List<? extends QueryElement>` | `getElements()`
`Selector` | `getSelector()` Get the selector
`boolean` | `hasElements()`
`void` | `set(Selector selector)` Sets the selector

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Negation

    public Negation()

  Constructor

### Negation

    public Negation(Selector selector)

  Constructor

  Parameters:
    `selector` - associated selector

Method Detail

### set

    public void set(Selector selector)

  Sets the selector

  Parameters:
    `selector` - the selector to set

### getSelector

    public Selector getSelector()

  Get the selector

  Returns:
    the current selector

### hasElements

    public boolean hasElements()

  Specified by:
    `hasElements` in interface `QueryElement`

### getElements

    public java.util.List<? extends QueryElement> getElements()

  Specified by:
    `getElements` in interface `QueryElement`

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD