commonlib/src/main/java/com/streamsets/pipeline/lib/util/AvroSchemaHelper.java
public static Map<String, Object> getDefaultValues(Schema schema) throws SchemaRegistryException {
    Map<String, Object> defaultValues = new HashMap<>();
    try {
      defaultValues.putAll(AvroTypeUtil.getDefaultValuesFromSchema(schema, new HashSet<String>()));
    } catch (IOException e) {
      throw new SchemaRegistryException(e);
    }
    return defaultValues;
  }
public static Map<String, Object> getDefaultValues(Schema schema) throws SchemaRegistryException {
    Map<String, Object> defaultValues = new HashMap<>();
    try {
      defaultValues.putAll(AvroTypeUtil.getDefaultValuesFromSchema(schema, new HashSet<String>()));
    } catch (IOException e) {
      throw new SchemaRegistryException(e);
    }
    return defaultValues;
  }
public static Map < String , Object > getDefaultValues ( Schema schema ) throws SchemaRegistryException { Map < String , Object > defaultValues = new HashMap <> ( ) ; try { defaultValues . putAll ( AvroTypeUtil . getDefaultValuesFromSchema ( schema , new HashSet < String > ( ) ) ) ; } catch ( IOException e ) { throw new SchemaRegistryException ( e ) ; } return defaultValues ; }
Helper method to extract default values from a Schema. This is normally done
in DataGeneratorFormat validation, however we have to do it at runtime for
Schema Registry.
@param schema schema to extract default values from
@return map of default value
@throws SchemaRegistryException
Helper method to extract default values from a Schema . This is normally done in DataGeneratorFormat validation however we have to do it at runtime for Schema Registry .