Interface TargetList.Projection

All Superinterfaces:
Collection<Attribute>, Iterable<Attribute>, List<Attribute>, SequencedCollection<Attribute>, TargetList
All Known Subinterfaces:
TupleDescriptor, TupleDescriptor.Ephemeral, TupleDescriptor.Interned
Enclosing interface:
TargetList

public static interface TargetList.Projection extends TargetList
A TargetList in which no one attribute may appear more than once.

The prime example of a Projection is a TupleDescriptor as obtained, for example, from the Portal for a query result.

To preserve the "no attribute appears more than once" property, the only new Projections derivable from an existing one involve selecting a subset of its attributes, and possibly changing their order. The project methods taking attribute names, attribute indices, or the attributes themselves can be used to do so, as can the subList method.

  • Method Details

    • project

      From this Projection, returns a Projection containing only the attributes matching the supplied names and in the order of the argument list.
      Throws:
      IllegalArgumentException - if more names are supplied than this Projection has attributes, or if any remain unmatched after matching each attribute in this Projection at most once.
    • project

      default TargetList.Projection project(CharSequence... names)
      From this Projection, returns a Projection containing only the attributes matching the supplied names and in the order of the argument list.

      The names will be converted to Identifier.Simple by its fromJava method before comparison.

      Throws:
      IllegalArgumentException - if more names are supplied than this Projection has attributes, or if any remain unmatched after matching each attribute in this Projection at most once.
    • project

      TargetList.Projection project(int... indices)
      Returns a Projection containing only the attributes found at the supplied indices in this Projection, and in the order of the argument list.

      The index of the first attribute is zero.

      Throws:
      IllegalArgumentException - if more indices are supplied than this Projection has attributes, if any index is negative or beyond the last index in this Projection, or if any index appears more than once.
    • sqlProject

      TargetList.Projection sqlProject(int... indices)
      Like project(int...) but using SQL's 1-based indexing convention.

      The index of the first attribute is 1.

      Throws:
      IllegalArgumentException - if more indices are supplied than this Projection has attributes, if any index is nonpositive or beyond the last 1-based index in this Projection, or if any index appears more than once.
    • project

      TargetList.Projection project(Attribute... attributes)
      Returns a Projection containing only attributes and in the order of the argument list.

      The attributes must be found in this Projection by exact reference identity.

      Throws:
      IllegalArgumentException - if more attributes are supplied than this Projection has, or if any remain unmatched after matching each attribute in this Projection at most once.
    • subList

      TargetList.Projection subList(int fromIndex, int toIndex)
      Specified by:
      subList in interface List<Attribute>
      Specified by:
      subList in interface TargetList