Revision created by MOE tool push_codebase.
[gae.git] / java / src / main / com / google / appengine / api / datastore / IndexComponent.java
blobfeca931d8754c2d00a044e515b0d4772cec2988f
1 // Copyright 2012 Google Inc. All Rights Reserved.
3 package com.google.appengine.api.datastore;
5 import com.google.storage.onestore.v3.OnestoreEntity.Index.Property;
7 import java.util.List;
9 /**
10 * An interface that represents a collection of index constraints. It can validate
11 * if an index satisfies the constraints.
14 interface IndexComponent {
16 /**
17 * Given a list of index {@link Property}s, returns true if the index matches the
18 * constraints given by the {@link IndexComponent}.
20 * @param indexProperties the index properties to match against
21 * @return true if the index satisfies the component
23 boolean matches(List<Property> indexProperties);
25 /**
26 * Returns the list of {@link Property}s that best satisfy this index component.
28 List<Property> preferredIndexProperties();
30 /**
31 * Returns the number of index constraints in this component.
33 * If a {@code List<Property>} satisfies this {@link IndexComponent}, and thus
34 * {@link IndexComponent#matches} returns true, the number of properties
35 * satisfied will be equal to the size of the {@link IndexComponent}.
37 * @return the number of index constraints.
39 int size();