private static TupleGenerator asGenerator( JsonObject json)
    {
    TupleGenerator tupleGenerator = new TupleGenerator();

    Optional.ofNullable( json.getJsonNumber( TUPLES_KEY))
      .ifPresent( n -> tupleGenerator.setDefaultTupleSize( n.intValue()));

    Optional.ofNullable( json.getJsonNumber( SEED_KEY))
      .ifPresent( n -> tupleGenerator.setRandomSeed( n.longValue()));

    // Get any combiners for this generator.
    Optional.ofNullable( json.getJsonArray( COMBINERS_KEY))
      .map( combiners -> combiners.getValuesAs( JsonObject.class).stream())
      .orElse( Stream.empty())
      .forEach( combiner -> tupleGenerator.addCombiner( asCombiner( combiner)));

    return tupleGenerator;
    }
private static TupleGenerator asGenerator ( JsonObject json ) { TupleGenerator tupleGenerator = new TupleGenerator ( ) ; Optional . ofNullable ( json . getJsonNumber ( TUPLES_KEY ) ) . ifPresent ( n -> tupleGenerator . setDefaultTupleSize ( n . intValue ( ) ) ) ; Optional . ofNullable ( json . getJsonNumber ( SEED_KEY ) ) . ifPresent ( n -> tupleGenerator . setRandomSeed ( n . longValue ( ) ) ) ; Optional . ofNullable ( json . getJsonArray ( COMBINERS_KEY ) ) . map ( combiners -> combiners . getValuesAs ( JsonObject . class ) . stream ( ) ) . orElse ( Stream . empty ( ) ) . forEach ( combiner -> tupleGenerator . addCombiner ( asCombiner ( combiner ) ) ) ; return tupleGenerator ; }
Returns the generator represented by the given JSON object.