/*
 * Copyright 2019 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.avro;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
 * @author Zoltan Farkas
 */
public final class SchemaResolvers {

  private static final  SchemaResolver NO_RESOLVER = new SchemaResolver() {
    @Override
    public Schema resolveSchema(String id) {
      throw new UnsupportedOperationException();
    }

    @Override
    public String getId(Schema schema) {
      return null;
    }
  };


  private static final Map<String, SchemaResolver> REGISTERED_RESOLVERS=
      new ConcurrentHashMap<>();

  public static  SchemaResolver get(@Nullable final String name) {
    if (name == null) {
      return NO_RESOLVER;
    }
    return REGISTERED_RESOLVERS.get(name);
  }

  public static  SchemaResolver register(@Nonnull final String name, final SchemaResolver resolver) {
    return REGISTERED_RESOLVERS.put(name, resolver);
  }

  private SchemaResolvers() { }

}

@@ -1332,27 +1332,28 @@
  return 
-NO_RESOLVER
+getDefault()
 ;%0A    %7D%0A
@@ -1498,24 +1498,24 @@
 resolver) %7B%0A
-
     return R
@@ -1560,16 +1560,347 @@
 );%0A  %7D%0A%0A
+  public static  SchemaResolver registerDefault(final SchemaResolver resolver) %7B%0A    return REGISTERED_RESOLVERS.put(%22def%22, resolver);%0A  %7D%0A%0A  @Nonnull%0A  public static SchemaResolver getDefault() %7B%0A    SchemaResolver res = REGISTERED_RESOLVERS.get(%22def%22);%0A    if (res == null) %7B%0A      return NO_RESOLVER;%0A    %7D%0A    return res;%0A  %7D%0A%0A
   privat

support for default schema resolver.