Package dev.cel.expr

Class SourceInfo.Builder

    • Method Detail

      • internalGetMapField

        protected MapField internalGetMapField​(int number)
        Description copied from class: GeneratedMessageV3.Builder
        Gets the map field with the given field number. This method should be overridden in the generated message class if the message contains map fields. Unlike other field types, reflection support for map fields can't be implemented based on generated public API because we need to access a map field as a list in reflection API but the generated API only allows us to access it as a map. This method returns the underlying map field directly and thus enables us to access the map field as a list.
        Overrides:
        internalGetMapField in class GeneratedMessageV3.Builder<SourceInfo.Builder>
      • getDefaultInstanceForType

        public SourceInfo getDefaultInstanceForType()
        Description copied from interface: MessageLiteOrBuilder
        Get an instance of the type with no fields set. Because no fields are set, all getters for singular fields will return default values and repeated fields will appear empty. This may or may not be a singleton. This differs from the getDefaultInstance() method of generated message classes in that this method is an abstract method of the MessageLite interface whereas getDefaultInstance() is a static method of a specific class. They return the same thing.
        Specified by:
        getDefaultInstanceForType in interface MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface MessageOrBuilder
      • mergeFrom

        public SourceInfo.Builder mergeFrom​(Message other)
        Description copied from interface: Message.Builder
        Merge other into the message being built. other must have the exact same type as this (i.e. getDescriptorForType() == other.getDescriptorForType()).

        Merging occurs as follows. For each field:
        * For singular primitive fields, if the field is set in other, then other's value overwrites the value in this message.
        * For singular message fields, if the field is set in other, it is merged into the corresponding sub-message of this message using the same merging rules.
        * For repeated fields, the elements in other are concatenated with the elements in this message.
        * For oneof groups, if the other message has one of the fields set, the group of this message is cleared and replaced by the field of the other message, so that the oneof constraint is preserved.

        This is equivalent to the Message::MergeFrom method in C++.

        Specified by:
        mergeFrom in interface Message.Builder
        Overrides:
        mergeFrom in class AbstractMessage.Builder<SourceInfo.Builder>
      • getSyntaxVersion

        public java.lang.String getSyntaxVersion()
         The syntax version of the source, e.g. `cel1`.
         
        string syntax_version = 1;
        Specified by:
        getSyntaxVersion in interface SourceInfoOrBuilder
        Returns:
        The syntaxVersion.
      • getSyntaxVersionBytes

        public ByteString getSyntaxVersionBytes()
         The syntax version of the source, e.g. `cel1`.
         
        string syntax_version = 1;
        Specified by:
        getSyntaxVersionBytes in interface SourceInfoOrBuilder
        Returns:
        The bytes for syntaxVersion.
      • setSyntaxVersion

        public SourceInfo.Builder setSyntaxVersion​(java.lang.String value)
         The syntax version of the source, e.g. `cel1`.
         
        string syntax_version = 1;
        Parameters:
        value - The syntaxVersion to set.
        Returns:
        This builder for chaining.
      • clearSyntaxVersion

        public SourceInfo.Builder clearSyntaxVersion()
         The syntax version of the source, e.g. `cel1`.
         
        string syntax_version = 1;
        Returns:
        This builder for chaining.
      • setSyntaxVersionBytes

        public SourceInfo.Builder setSyntaxVersionBytes​(ByteString value)
         The syntax version of the source, e.g. `cel1`.
         
        string syntax_version = 1;
        Parameters:
        value - The bytes for syntaxVersion to set.
        Returns:
        This builder for chaining.
      • getLocation

        public java.lang.String getLocation()
         The location name. All position information attached to an expression is
         relative to this location.
         The location could be a file, UI element, or similar. For example,
         `acme/app/AnvilPolicy.cel`.
         
        string location = 2;
        Specified by:
        getLocation in interface SourceInfoOrBuilder
        Returns:
        The location.
      • getLocationBytes

        public ByteString getLocationBytes()
         The location name. All position information attached to an expression is
         relative to this location.
         The location could be a file, UI element, or similar. For example,
         `acme/app/AnvilPolicy.cel`.
         
        string location = 2;
        Specified by:
        getLocationBytes in interface SourceInfoOrBuilder
        Returns:
        The bytes for location.
      • setLocation

        public SourceInfo.Builder setLocation​(java.lang.String value)
         The location name. All position information attached to an expression is
         relative to this location.
         The location could be a file, UI element, or similar. For example,
         `acme/app/AnvilPolicy.cel`.
         
        string location = 2;
        Parameters:
        value - The location to set.
        Returns:
        This builder for chaining.
      • clearLocation

        public SourceInfo.Builder clearLocation()
         The location name. All position information attached to an expression is
         relative to this location.
         The location could be a file, UI element, or similar. For example,
         `acme/app/AnvilPolicy.cel`.
         
        string location = 2;
        Returns:
        This builder for chaining.
      • setLocationBytes

        public SourceInfo.Builder setLocationBytes​(ByteString value)
         The location name. All position information attached to an expression is
         relative to this location.
         The location could be a file, UI element, or similar. For example,
         `acme/app/AnvilPolicy.cel`.
         
        string location = 2;
        Parameters:
        value - The bytes for location to set.
        Returns:
        This builder for chaining.
      • getLineOffsetsList

        public java.util.List<java.lang.Integer> getLineOffsetsList()
         Monotonically increasing list of code point offsets where newlines
         `\n` appear.
         The line number of a given position is the index `i` where for a given
         `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The
         column may be derived from `id_positions[id] - line_offsets[i]`.
         
        repeated int32 line_offsets = 3;
        Specified by:
        getLineOffsetsList in interface SourceInfoOrBuilder
        Returns:
        A list containing the lineOffsets.
      • getLineOffsetsCount

        public int getLineOffsetsCount()
         Monotonically increasing list of code point offsets where newlines
         `\n` appear.
         The line number of a given position is the index `i` where for a given
         `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The
         column may be derived from `id_positions[id] - line_offsets[i]`.
         
        repeated int32 line_offsets = 3;
        Specified by:
        getLineOffsetsCount in interface SourceInfoOrBuilder
        Returns:
        The count of lineOffsets.
      • getLineOffsets

        public int getLineOffsets​(int index)
         Monotonically increasing list of code point offsets where newlines
         `\n` appear.
         The line number of a given position is the index `i` where for a given
         `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The
         column may be derived from `id_positions[id] - line_offsets[i]`.
         
        repeated int32 line_offsets = 3;
        Specified by:
        getLineOffsets in interface SourceInfoOrBuilder
        Parameters:
        index - The index of the element to return.
        Returns:
        The lineOffsets at the given index.
      • setLineOffsets

        public SourceInfo.Builder setLineOffsets​(int index,
                                                 int value)
         Monotonically increasing list of code point offsets where newlines
         `\n` appear.
         The line number of a given position is the index `i` where for a given
         `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The
         column may be derived from `id_positions[id] - line_offsets[i]`.
         
        repeated int32 line_offsets = 3;
        Parameters:
        index - The index to set the value at.
        value - The lineOffsets to set.
        Returns:
        This builder for chaining.
      • addLineOffsets

        public SourceInfo.Builder addLineOffsets​(int value)
         Monotonically increasing list of code point offsets where newlines
         `\n` appear.
         The line number of a given position is the index `i` where for a given
         `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The
         column may be derived from `id_positions[id] - line_offsets[i]`.
         
        repeated int32 line_offsets = 3;
        Parameters:
        value - The lineOffsets to add.
        Returns:
        This builder for chaining.
      • addAllLineOffsets

        public SourceInfo.Builder addAllLineOffsets​(java.lang.Iterable<? extends java.lang.Integer> values)
         Monotonically increasing list of code point offsets where newlines
         `\n` appear.
         The line number of a given position is the index `i` where for a given
         `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The
         column may be derived from `id_positions[id] - line_offsets[i]`.
         
        repeated int32 line_offsets = 3;
        Parameters:
        values - The lineOffsets to add.
        Returns:
        This builder for chaining.
      • clearLineOffsets

        public SourceInfo.Builder clearLineOffsets()
         Monotonically increasing list of code point offsets where newlines
         `\n` appear.
         The line number of a given position is the index `i` where for a given
         `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The
         column may be derived from `id_positions[id] - line_offsets[i]`.
         
        repeated int32 line_offsets = 3;
        Returns:
        This builder for chaining.
      • getPositionsCount

        public int getPositionsCount()
        Description copied from interface: SourceInfoOrBuilder
         A map from the parse node id (e.g. `Expr.id`) to the code point offset
         within the source.
         
        map<int64, int32> positions = 4;
        Specified by:
        getPositionsCount in interface SourceInfoOrBuilder
      • containsPositions

        public boolean containsPositions​(long key)
         A map from the parse node id (e.g. `Expr.id`) to the code point offset
         within the source.
         
        map<int64, int32> positions = 4;
        Specified by:
        containsPositions in interface SourceInfoOrBuilder
      • getPositionsMap

        public java.util.Map<java.lang.Long,​java.lang.Integer> getPositionsMap()
         A map from the parse node id (e.g. `Expr.id`) to the code point offset
         within the source.
         
        map<int64, int32> positions = 4;
        Specified by:
        getPositionsMap in interface SourceInfoOrBuilder
      • getPositionsOrDefault

        public int getPositionsOrDefault​(long key,
                                         int defaultValue)
         A map from the parse node id (e.g. `Expr.id`) to the code point offset
         within the source.
         
        map<int64, int32> positions = 4;
        Specified by:
        getPositionsOrDefault in interface SourceInfoOrBuilder
      • getPositionsOrThrow

        public int getPositionsOrThrow​(long key)
         A map from the parse node id (e.g. `Expr.id`) to the code point offset
         within the source.
         
        map<int64, int32> positions = 4;
        Specified by:
        getPositionsOrThrow in interface SourceInfoOrBuilder
      • removePositions

        public SourceInfo.Builder removePositions​(long key)
         A map from the parse node id (e.g. `Expr.id`) to the code point offset
         within the source.
         
        map<int64, int32> positions = 4;
      • getMutablePositions

        @Deprecated
        public java.util.Map<java.lang.Long,​java.lang.Integer> getMutablePositions()
        Deprecated.
        Use alternate mutation accessors instead.
      • putPositions

        public SourceInfo.Builder putPositions​(long key,
                                               int value)
         A map from the parse node id (e.g. `Expr.id`) to the code point offset
         within the source.
         
        map<int64, int32> positions = 4;
      • putAllPositions

        public SourceInfo.Builder putAllPositions​(java.util.Map<java.lang.Long,​java.lang.Integer> values)
         A map from the parse node id (e.g. `Expr.id`) to the code point offset
         within the source.
         
        map<int64, int32> positions = 4;
      • getMacroCallsCount

        public int getMacroCallsCount()
        Description copied from interface: SourceInfoOrBuilder
         A map from the parse node id where a macro replacement was made to the
         call `Expr` that resulted in a macro expansion.
         For example, `has(value.field)` is a function call that is replaced by a
         `test_only` field selection in the AST. Likewise, the call
         `list.exists(e, e > 10)` translates to a comprehension expression. The key
         in the map corresponds to the expression id of the expanded macro, and the
         value is the call `Expr` that was replaced.
         
        map<int64, .cel.expr.Expr> macro_calls = 5;
        Specified by:
        getMacroCallsCount in interface SourceInfoOrBuilder
      • containsMacroCalls

        public boolean containsMacroCalls​(long key)
         A map from the parse node id where a macro replacement was made to the
         call `Expr` that resulted in a macro expansion.
         For example, `has(value.field)` is a function call that is replaced by a
         `test_only` field selection in the AST. Likewise, the call
         `list.exists(e, e > 10)` translates to a comprehension expression. The key
         in the map corresponds to the expression id of the expanded macro, and the
         value is the call `Expr` that was replaced.
         
        map<int64, .cel.expr.Expr> macro_calls = 5;
        Specified by:
        containsMacroCalls in interface SourceInfoOrBuilder
      • getMacroCallsMap

        public java.util.Map<java.lang.Long,​Expr> getMacroCallsMap()
         A map from the parse node id where a macro replacement was made to the
         call `Expr` that resulted in a macro expansion.
         For example, `has(value.field)` is a function call that is replaced by a
         `test_only` field selection in the AST. Likewise, the call
         `list.exists(e, e > 10)` translates to a comprehension expression. The key
         in the map corresponds to the expression id of the expanded macro, and the
         value is the call `Expr` that was replaced.
         
        map<int64, .cel.expr.Expr> macro_calls = 5;
        Specified by:
        getMacroCallsMap in interface SourceInfoOrBuilder
      • getMacroCallsOrDefault

        public Expr getMacroCallsOrDefault​(long key,
                                           Expr defaultValue)
         A map from the parse node id where a macro replacement was made to the
         call `Expr` that resulted in a macro expansion.
         For example, `has(value.field)` is a function call that is replaced by a
         `test_only` field selection in the AST. Likewise, the call
         `list.exists(e, e > 10)` translates to a comprehension expression. The key
         in the map corresponds to the expression id of the expanded macro, and the
         value is the call `Expr` that was replaced.
         
        map<int64, .cel.expr.Expr> macro_calls = 5;
        Specified by:
        getMacroCallsOrDefault in interface SourceInfoOrBuilder
      • getMacroCallsOrThrow

        public Expr getMacroCallsOrThrow​(long key)
         A map from the parse node id where a macro replacement was made to the
         call `Expr` that resulted in a macro expansion.
         For example, `has(value.field)` is a function call that is replaced by a
         `test_only` field selection in the AST. Likewise, the call
         `list.exists(e, e > 10)` translates to a comprehension expression. The key
         in the map corresponds to the expression id of the expanded macro, and the
         value is the call `Expr` that was replaced.
         
        map<int64, .cel.expr.Expr> macro_calls = 5;
        Specified by:
        getMacroCallsOrThrow in interface SourceInfoOrBuilder
      • removeMacroCalls

        public SourceInfo.Builder removeMacroCalls​(long key)
         A map from the parse node id where a macro replacement was made to the
         call `Expr` that resulted in a macro expansion.
         For example, `has(value.field)` is a function call that is replaced by a
         `test_only` field selection in the AST. Likewise, the call
         `list.exists(e, e > 10)` translates to a comprehension expression. The key
         in the map corresponds to the expression id of the expanded macro, and the
         value is the call `Expr` that was replaced.
         
        map<int64, .cel.expr.Expr> macro_calls = 5;
      • getMutableMacroCalls

        @Deprecated
        public java.util.Map<java.lang.Long,​Expr> getMutableMacroCalls()
        Deprecated.
        Use alternate mutation accessors instead.
      • putMacroCalls

        public SourceInfo.Builder putMacroCalls​(long key,
                                                Expr value)
         A map from the parse node id where a macro replacement was made to the
         call `Expr` that resulted in a macro expansion.
         For example, `has(value.field)` is a function call that is replaced by a
         `test_only` field selection in the AST. Likewise, the call
         `list.exists(e, e > 10)` translates to a comprehension expression. The key
         in the map corresponds to the expression id of the expanded macro, and the
         value is the call `Expr` that was replaced.
         
        map<int64, .cel.expr.Expr> macro_calls = 5;
      • putAllMacroCalls

        public SourceInfo.Builder putAllMacroCalls​(java.util.Map<java.lang.Long,​Expr> values)
         A map from the parse node id where a macro replacement was made to the
         call `Expr` that resulted in a macro expansion.
         For example, `has(value.field)` is a function call that is replaced by a
         `test_only` field selection in the AST. Likewise, the call
         `list.exists(e, e > 10)` translates to a comprehension expression. The key
         in the map corresponds to the expression id of the expanded macro, and the
         value is the call `Expr` that was replaced.
         
        map<int64, .cel.expr.Expr> macro_calls = 5;