class TableFieldMappingResource {

    @GET
    @Timed
    @Path("/fields")
    @ApiOperation("Get all Fields")
    public Response getAllFields(@QueryParam("withCardinality") @DefaultValue("false") boolean withCardinality,
                                 @QueryParam("calculateCardinality") @DefaultValue("false") boolean calculateCardinality) {
        return Response.ok()
                .entity(tableManager.getAll()
                                .stream()
                                .collect(Collectors.toMap(Table::getName,
                                                          table -> tableMetadataManager.getFieldMappings(table.getName(), withCardinality,
                                                                                                         calculateCardinality
                                                                                                        )
                                                         )))
                .build();
    }

    @Inject public  TableFieldMappingResource(TableManager tableManager, TableMetadataManager tableMetadataManager);

}