001/* -*- mode: Java; c-basic-offset: 2; indent-tabs-mode: nil; coding: utf-8-unix -*- 002 * 003 * Copyright © 2022–2025 microBean™. 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 006 * the License. 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 distributed under the License is distributed on 011 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 012 * specific language governing permissions and limitations under the License. 013 */ 014package org.microbean.scope; 015 016import java.util.Objects; 017 018import org.microbean.attributes.Attributes; 019 020/** 021 * A governed member of a governing {@link Scope}. 022 * 023 * @author <a href="https://about.me/lairdnelson" target="_top">Laird Nelson</a> 024 * 025 * @deprecated This interface will be removed with no replacement. 026 */ 027@Deprecated(forRemoval = true) 028@FunctionalInterface 029public interface ScopeMember { 030 031 /** 032 * Returns an {@link Attributes} identifying the scope that governs this {@link ScopeMember}. 033 * 034 * @return a non-{@code null} {@link Attributes} 035 */ 036 public Attributes governingScopeId(); 037 038 /** 039 * Returns {@code true} if and only if this {@link ScopeMember} is governed by a scope identified by the supplied 040 * {@code governingScopeId}. 041 * 042 * @param governingScopeId an {@link Attributes}; may be {@code null} in which case {@code false} will be returned 043 * 044 * @return {@code true} if and only if this {@link ScopeMember} is governed by a scope identified by the supplied 045 * {@code governingScopeId} 046 */ 047 public default boolean governedBy(final Attributes governingScopeId) { 048 return Objects.equals(this.governingScopeId(), governingScopeId); 049 } 050 051}