001/*
002 * Copyright 2026 Revetware LLC.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package com.revetsec.scim;
017
018import org.jspecify.annotations.NonNull;
019
020import com.google.errorprone.annotations.CheckReturnValue;
021import javax.annotation.concurrent.NotThreadSafe;
022
023/**
024 * Visits each closed SCIM filter node kind on Java 17. A visitor controls its own
025 * traversal and is responsible for binding and policy approval before execution.
026 * Implementations can keep traversal state; callers control their concurrent use.
027 *
028 * @param <R> the nonnull result type
029 * @since 1.0.0
030 */
031@NotThreadSafe
032public interface ScimFilterVisitor<R extends @NonNull Object> {
033    /** Visits a conjunction.
034     * @param filter node
035     * @return result
036     * @since 1.0.0
037     */
038    @CheckReturnValue @NonNull R visitAnd(ScimFilter.@NonNull And filter);
039    /** Visits a disjunction.
040     * @param filter node
041     * @return result
042     * @since 1.0.0
043     */
044    @CheckReturnValue @NonNull R visitOr(ScimFilter.@NonNull Or filter);
045    /** Visits a negation.
046     * @param filter node
047     * @return result
048     * @since 1.0.0
049     */
050    @CheckReturnValue @NonNull R visitNot(ScimFilter.@NonNull Not filter);
051    /** Visits a comparison.
052     * @param filter node
053     * @return result
054     * @since 1.0.0
055     */
056    @CheckReturnValue @NonNull R visitComparison(ScimFilter.@NonNull Comparison filter);
057    /** Visits a presence test.
058     * @param filter node
059     * @return result
060     * @since 1.0.0
061     */
062    @CheckReturnValue @NonNull R visitPresent(ScimFilter.@NonNull Present filter);
063    /** Visits a same-element value path.
064     * @param filter node
065     * @return result
066     * @since 1.0.0
067     */
068    @CheckReturnValue @NonNull R visitValuePath(ScimFilter.@NonNull ValuePath filter);
069}