Interface If<V,P>

All Known Implementing Classes:
Always, IfDefault, IfEmpty, IfEmptyString, IfFalse, IfNotDefault, IfNotEmpty, IfNotNull, IfNotZero, IfNull, IfTrue, IfZero, PojoIf, ValueIf

public interface If<V,P>

A simple interface that defines a condition test for a field value or whole entity. For example, you could have a class that tests against null values called IfNull. This interface is used by the @IgnoreSave, @Index, and @Unindex annotations.

The matching engine will call both methods; if either return true the condition is considered true.

All implementations of this interface will be created with ObjectifyFactory.construct(). If the implementation also implements the InitializeIf interface, the init() method will be called immediately after construction.

Author:
Jeff Schnitzer invalid input: '<'[email protected]>
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    matchesPojo(P pojo)
    Override this method to test a whole pojo for your condition.
    boolean
    matchesValue(V value)
    Test a simple property value.
  • Method Details

    • matchesValue

      boolean matchesValue(V value)
      Test a simple property value.
      Parameters:
      value - is the actual value of a particular field
      Returns:
      true if the value matches the condition defined by an instance of this interface.
    • matchesPojo

      boolean matchesPojo(P pojo)
      Override this method to test a whole pojo for your condition. The pojo might be an entity or an embedded class object - whichever holds the field being tested.
      Parameters:
      pojo - is the entity object on which the field/value exists
      Returns:
      true if the value matches the condition defined by an instance of this interface.