Interface RouteGroup.ListRouteMounter<T>

All Superinterfaces:
RouteGroup.RouteMounter
Enclosing interface:
RouteGroup

public static interface RouteGroup.ListRouteMounter<T> extends RouteGroup.RouteMounter
A "list" route is a route that returns a list of items. Using a list route mounter is used for routes that want automatic handling for paging (limit + offset), filtering (field[eq]=value), sorting (sortBy=asc(field)), and searching (search=term1%20term2).
See Also:
  • Method Details

    • fieldResolver

      A list route needs a field resolver in order to support sortBy, search, or filter parameters. The field resolver understands how to extract the value of a field from an item given a field name. If an explicit field resolver is not specified, one will be automatically created using the itemSerializer(Function).
    • automaticFieldResolution

      RouteGroup.ListRouteMounter<T> automaticFieldResolution(boolean deepKeys)
      Will create an automatic FilterSortPageHelper.FieldResolver based upon the item serializer, by serializing each item and looking within the resulting json for fields. Note that this may be inefficient compared to a bespoke field resolver, and routes that expect large result sets should probably not use this method.
      Parameters:
      deepKeys - If true, keys will be resolved using JsonPath so that fields nested deeply within the object may be resolved.
    • itemSerializer

      RouteGroup.ListRouteMounter<T> itemSerializer(Function<T,com.inductiveautomation.ignition.common.gson.JsonElement> itemSerializer)
      Unlike free-form routes, list routes always return json as a result. The item serializer is used to convert each item into a json element.
    • itemSerializer

      default RouteGroup.ListRouteMounter<T> itemSerializer(com.inductiveautomation.ignition.common.gson.Gson gson)
      Equivalent to calling itemSerializer(gson::toJsonTree)
    • searchFields

      RouteGroup.ListRouteMounter<T> searchFields(Set<String> searchFields)
      Must be specified in order to enable searching. Specifies which fields should be searched through if a search string is provided. Fields are expected to be strings, or will be Object.toString()'ed in order to match search queries.
    • searchFields

      default RouteGroup.ListRouteMounter<T> searchFields(String... searchFields)
      Equivalent to calling searchFields(Set.of("field1", "field2", "etc"))
    • ignoredFields

      RouteGroup.ListRouteMounter<T> ignoredFields(Set<String> ignoredFields)
      Fields that are being handled before going to `FilterSortPageRouteAdapter`, and can be ignored from further filtering.
    • ignoredFields

      default RouteGroup.ListRouteMounter<T> ignoredFields(String... ignoredFields)
      Equivalent to calling ignoredFields(Set.of("field1", "field2", "etc"))
    • metadataMetric

      RouteGroup.ListRouteMounter<T> metadataMetric(Function<RequestContext,org.apache.commons.lang3.tuple.Pair<String,com.codahale.metrics.Metric>> metricResolver)
      If specified, the given resolver will be invoked once per route request, to provide a Metric that will be included in the response's metadata section. This method may be invoked multiple times to include multiple metrics.
    • itemSchema

      RouteGroup.ListRouteMounter<T> itemSchema(com.inductiveautomation.ignition.common.gson.JsonObject itemSchema)
      If provided, and if RouteGroup.RouteMounter.openApi(Consumer) is invoked, the open api operation object will include a schema for the array of items (plus metadata) returned by this route.
    • metadataMetrics

      default RouteGroup.ListRouteMounter<T> metadataMetrics(String... metricKeys)
      Convenience method that will create metadata metric resolvers that look up the given metric keys in the default registry found at GatewayContext.getMetricRegistry()