private def getNonNullSchema()

in elitzur-avro/src/main/scala/com/spotify/elitzur/converters/avro/dynamic/dsl/AvroAccessorLogics.scala [58:65]


  private def getNonNullSchema(schema: Schema): Schema = {
    val nonNullSchemas: ju.ArrayList[Schema] = new ju.ArrayList[Schema]
    schema.getTypes.forEach(s => if (s.getType != Schema.Type.NULL) {nonNullSchemas.add(s)})
    if (nonNullSchemas.size > 1) {
      throw new InvalidDynamicFieldException(INVALID_UNION_SCHEMA)
    }
    nonNullSchemas.get(0)
  }