001/*
002 * Copyright 2015-2024 Ping Identity Corporation
003 *
004 * This program is free software; you can redistribute it and/or modify
005 * it under the terms of the GNU General Public License (GPLv2 only)
006 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
007 * as published by the Free Software Foundation.
008 *
009 * This program is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012 * GNU General Public License for more details.
013 *
014 * You should have received a copy of the GNU General Public License
015 * along with this program; if not, see <http://www.gnu.org/licenses>.
016 */
017
018package com.unboundid.scim2.server.utils;
019
020import com.unboundid.scim2.common.Path;
021import com.unboundid.scim2.common.annotations.NotNull;
022import com.unboundid.scim2.common.annotations.Nullable;
023import com.unboundid.scim2.common.types.AttributeDefinition;
024import com.unboundid.scim2.common.utils.FilterEvaluator;
025
026/**
027 * A schema aware filter evaluator that respects case sensitivity.
028 */
029public class SchemaAwareFilterEvaluator extends FilterEvaluator
030{
031  @NotNull
032  private final ResourceTypeDefinition resourceType;
033
034  /**
035   * Create a new schema aware filter evaluator.
036   *
037   * @param resourceType The resource type definition.
038   */
039  public SchemaAwareFilterEvaluator(
040      @NotNull final ResourceTypeDefinition resourceType)
041  {
042    this.resourceType = resourceType;
043  }
044
045  /**
046   * {@inheritDoc}
047   */
048  @Override
049  @Nullable
050  protected AttributeDefinition getAttributeDefinition(@NotNull final Path path)
051  {
052    return resourceType.getAttributeDefinition(path);
053  }
054}