Interface EntityGraph

  • All Known Implementing Classes:
    EmptyEntityGraphImpl, EntityGraphImpl

    public interface EntityGraph
    Class available to entity-filtering processors providing means to add/remove entity-filtering scopes (e.g. based on annotations) for entity members.

    Differences between this class and object graph:

    • EntityGraph can be modified, ObjectGraph is read-only.
    • EntityGraph contains information about all entity-filtering scopes found during inspecting an entity class, ObjectGraph provides information about entity to create a filtering object for a subset of these scopes (which are determined from the current context).

    Note: Definition of entity-filtering scopes can be found in ScopeResolver.

    See Also:
    ScopeResolver
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      EntityGraph addField​(java.lang.String fieldName)
      Add a field into this graph for all existing entity-filtering scopes.
      EntityGraph addField​(java.lang.String fieldName, java.lang.String... filteringScopes)
      Add a field into this graph for given list of entity-filtering scopes.
      EntityGraph addField​(java.lang.String fieldName, java.util.Set<java.lang.String> filteringScopes)
      Add a field into this graph for given set of entity-filtering scopes.
      EntityGraph addFilteringScopes​(java.util.Set<java.lang.String> filteringScopes)
      Add a set of entity-filtering scopes to this graph.
      EntityGraph addSubgraph​(java.lang.String fieldName, java.lang.Class<?> fieldClass)
      Add a subgraph into this graph for all existing entity-filtering scopes.
      EntityGraph addSubgraph​(java.lang.String fieldName, java.lang.Class<?> fieldClass, java.lang.String... filteringScopes)
      Add a subgraph into this graph for given list of entity-filtering scopes.
      EntityGraph addSubgraph​(java.lang.String fieldName, java.lang.Class<?> fieldClass, java.util.Set<java.lang.String> filteringScopes)
      Add a subgraph into this graph for given set of entity-filtering scopes.
      java.util.Set<java.lang.String> getClassFilteringScopes()
      Get all available entity-filtering scopes defined on a class.
      java.lang.Class<?> getEntityClass()
      Get an entity class this graph is created for.
      java.util.Set<java.lang.String> getFields​(java.lang.String filteringScope)
      Get fields for given entity-filtering scope.
      java.util.Set<java.lang.String> getFields​(java.lang.String... filteringScopes)
      Get fields for given entity-filtering scopes.
      java.util.Set<java.lang.String> getFields​(java.util.Set<java.lang.String> filteringScopes)
      Get fields for given entity-filtering scopes.
      java.util.Set<java.lang.String> getFilteringScopes()
      Get all available entity-filtering scopes.
      java.util.Map<java.lang.String,​java.lang.Class<?>> getSubgraphs​(java.lang.String filteringScope)
      Get subgraphs for given entity-filtering scope.
      java.util.Map<java.lang.String,​java.lang.Class<?>> getSubgraphs​(java.lang.String... filteringScopes)
      Get subgraphs for given entity-filtering scopes.
      java.util.Map<java.lang.String,​java.lang.Class<?>> getSubgraphs​(java.util.Set<java.lang.String> filteringScopes)
      Get subgraphs for given entity-filtering scopes.
      boolean presentInScope​(java.lang.String field, java.lang.String filteringScope)
      Determines whether a field/subgraph is present in ANY of the given scopes.
      boolean presentInScopes​(java.lang.String field)
      Determines whether a field/subgraph is present in ANY of the existing scopes.
      EntityGraph remove​(java.lang.String name)
      Remove a field/subgraph from the graph (all entity-filtering scopes).
    • Method Detail

      • addField

        EntityGraph addField​(java.lang.String fieldName)
        Add a field into this graph for all existing entity-filtering scopes.
        Parameters:
        fieldName - name of the field to be added.
        Returns:
        an entity-filtering graph instance.
      • addField

        EntityGraph addField​(java.lang.String fieldName,
                             java.lang.String... filteringScopes)
        Add a field into this graph for given list of entity-filtering scopes.
        Parameters:
        fieldName - name of the field to be added.
        filteringScopes - entity-filtering scopes for the field.
        Returns:
        an entity-filtering graph instance.
      • addField

        EntityGraph addField​(java.lang.String fieldName,
                             java.util.Set<java.lang.String> filteringScopes)
        Add a field into this graph for given set of entity-filtering scopes.
        Parameters:
        fieldName - name of the field to be added.
        filteringScopes - entity-filtering scopes for the field.
        Returns:
        an entity-filtering graph instance.
      • addSubgraph

        EntityGraph addSubgraph​(java.lang.String fieldName,
                                java.lang.Class<?> fieldClass)
        Add a subgraph into this graph for all existing entity-filtering scopes.
        Parameters:
        fieldName - name of the subgraph field to be added.
        fieldClass - entity class representing the subgraph.
        Returns:
        an entity-filtering graph instance.
      • addSubgraph

        EntityGraph addSubgraph​(java.lang.String fieldName,
                                java.lang.Class<?> fieldClass,
                                java.lang.String... filteringScopes)
        Add a subgraph into this graph for given list of entity-filtering scopes.
        Parameters:
        fieldName - name of the subgraph field to be added.
        fieldClass - entity class representing the subgraph.
        filteringScopes - entity-filtering scopes for the subgraph.
        Returns:
        an entity-filtering graph instance.
      • addSubgraph

        EntityGraph addSubgraph​(java.lang.String fieldName,
                                java.lang.Class<?> fieldClass,
                                java.util.Set<java.lang.String> filteringScopes)
        Add a subgraph into this graph for given set of entity-filtering scopes.
        Parameters:
        fieldName - name of the subgraph field to be added.
        fieldClass - entity class representing the subgraph.
        filteringScopes - entity-filtering scopes for the subgraph.
        Returns:
        an entity-filtering graph instance.
      • addFilteringScopes

        EntityGraph addFilteringScopes​(java.util.Set<java.lang.String> filteringScopes)
        Add a set of entity-filtering scopes to this graph.
        Parameters:
        filteringScopes - entity-filtering scopes to be added.
        Returns:
        an entity-filtering graph instance.
      • presentInScope

        boolean presentInScope​(java.lang.String field,
                               java.lang.String filteringScope)
        Determines whether a field/subgraph is present in ANY of the given scopes. If no scopes are given the return value determines whether the field is present in any scope.
        Parameters:
        field - field to be checked.
        filteringScope - entity-filtering scope.
        Returns:
        true if field is present in the given scope, false otherwise.
      • presentInScopes

        boolean presentInScopes​(java.lang.String field)
        Determines whether a field/subgraph is present in ANY of the existing scopes.
        Parameters:
        field - field to be checked.
        Returns:
        true if field is present in ANY of the existing scopes, false otherwise.
      • getEntityClass

        java.lang.Class<?> getEntityClass()
        Get an entity class this graph is created for.
        Returns:
        an entity class.
      • getFields

        java.util.Set<java.lang.String> getFields​(java.lang.String filteringScope)
        Get fields for given entity-filtering scope.
        Parameters:
        filteringScope - scope the returned fields have to be in.
        Returns:
        set of fields present in given scope.
      • getFields

        java.util.Set<java.lang.String> getFields​(java.lang.String... filteringScopes)
        Get fields for given entity-filtering scopes.
        Parameters:
        filteringScopes - scopes the returned fields have to be in.
        Returns:
        set of fields present in given scopes.
      • getFields

        java.util.Set<java.lang.String> getFields​(java.util.Set<java.lang.String> filteringScopes)
        Get fields for given entity-filtering scopes.
        Parameters:
        filteringScopes - scopes the returned fields have to be in.
        Returns:
        set of fields present in given scopes.
      • getFilteringScopes

        java.util.Set<java.lang.String> getFilteringScopes()
        Get all available entity-filtering scopes.
        Returns:
        all available entity-filtering scopes.
      • getClassFilteringScopes

        java.util.Set<java.lang.String> getClassFilteringScopes()
        Get all available entity-filtering scopes defined on a class.
        Returns:
        all available entity-filtering scopes.
      • getSubgraphs

        java.util.Map<java.lang.String,​java.lang.Class<?>> getSubgraphs​(java.lang.String filteringScope)
        Get subgraphs for given entity-filtering scope.
        Parameters:
        filteringScope - scope the returned subgraphs have to be in.
        Returns:
        map of subgraphs present in given scope.
      • getSubgraphs

        java.util.Map<java.lang.String,​java.lang.Class<?>> getSubgraphs​(java.lang.String... filteringScopes)
        Get subgraphs for given entity-filtering scopes.
        Parameters:
        filteringScopes - scopes the returned subgraphs have to be in.
        Returns:
        map of subgraphs present in given scopes.
      • getSubgraphs

        java.util.Map<java.lang.String,​java.lang.Class<?>> getSubgraphs​(java.util.Set<java.lang.String> filteringScopes)
        Get subgraphs for given entity-filtering scopes.
        Parameters:
        filteringScopes - scopes the returned subgraphs have to be in.
        Returns:
        map of subgraphs present in given scopes.
      • remove

        EntityGraph remove​(java.lang.String name)
        Remove a field/subgraph from the graph (all entity-filtering scopes).
        Parameters:
        name - name of the field/subgraph to be removed.
        Returns:
        an entity-filtering graph instance.