All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.sayayi.lib.protocol.ProtocolEntry Maven / Gradle / Ivy

There is a newer version: 1.5.0
Show newest version
/*
 * Copyright 2019 Jeroen Gremmen
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package de.sayayi.lib.protocol;

import de.sayayi.lib.protocol.matcher.MessageMatcher;

import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;

import java.util.List;


/**
 * @param   internal message object type
 *
 * @author Jeroen Gremmen
 * @since 0.1.0
 *
 * @see Message
 * @see Group
 */
@SuppressWarnings({"unused", "squid:S2326"})
public interface ProtocolEntry extends ProtocolQueryable
{
  /**
   * @param   internal message object type
   */
  interface Message extends ProtocolEntry, Protocol.Message
  {
    /**
     * Returns the protocol which contains this message.
     *
     * @return  protocol which contains this message, never {@code null}
     *
     * @since 1.1.0
     */
    @NotNull Protocol getProtocol();
  }




  /**
   * @param   internal message object type
   */
  @SuppressWarnings("squid:S2176")
  interface Group extends ProtocolEntry, Protocol.Group
  {
    /**
     * Returns a list of protocol entries provided by this protocol object for the given
     * {@code level} and {@code tagSelector}.
     *
     * @param matcher  message matcher, not {@code null}
     *
     * @return  a list of protocol entries, never {@code null}
     *
     * @since 1.0.0
     */
    @Contract(pure = true, value = "_ -> new")
    @NotNull List> getEntries(@NotNull MessageMatcher matcher);


    /**
     * Tells if, for the given {@code matcher}, the group header message is visible.
     *
     * @param matcher  message matcher, not {@code null}
     *
     * @return  {@code true} if the group header message is visible, {@code false} otherwise
     *
     * @since 1.0.0
     */
    @Contract(pure = true)
    boolean isHeaderVisible(@NotNull MessageMatcher matcher);


    /**
     * 

* Returns the level of the group header message for the given {@code matcher}. *

*

* The group header message level is defined as the highest (= most severe) level of all * containing messages and sub-groups which are visible for the given {@code matcher}. *

*

* If the group does not contain any messages, the returned value will be a level with the * lowest possible severity. *

* * @param matcher message matcher, not {@code null} * * @return header message level, never {@code null} * * @since 1.0.0 */ @Contract(pure = true) @NotNull Level getHeaderLevel(@NotNull MessageMatcher matcher); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy