* be the result. If none return a value null will be returned; if more than
* one does an {@link IllegalStateException} will be thrown.
*/
@Override
public DocumentSchema getSchemaForId(WaveletId waveletId, String documentId) {
DocumentSchema result = null;
for (SchemaProvider provider : providers) {
// TODO(user): Change the way providers (or individual schemas) are
// registered to catch ambiguities earlier.
DocumentSchema value = provider.getSchemaForId(waveletId, documentId);
assert value != null;
if (value != DocumentSchema.NO_SCHEMA_CONSTRAINTS) {
// Check that only one schema matches. This ensures that the ordering of
// resolvers doesn't influence which schema is used which could lead to
// some pretty horrible bugs.