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

com.phloc.commons.error.IHasErrorLevels Maven / Gradle / Ivy

There is a newer version: 5.0.0
Show newest version
/**
 * Copyright (C) 2006-2015 phloc systems
 * http://www.phloc.com
 * office[at]phloc[dot]com
 *
 * 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 com.phloc.commons.error;

import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;

/**
 * Interface representing an object having multiple objects with an error level
 * 
 * @author Philip Helger
 */
public interface IHasErrorLevels
{
  /**
   * Check if this group contains only success messages. If no item is present,
   * false is returned.
   * 
   * @return true if at least one item is present, and if all items
   *         have the error level success, false otherwise.
   */
  boolean containsOnlySuccess ();

  /**
   * Check if this group contains at least one success message.
   * 
   * @return true if at least one success item is present,
   *         false otherwise.
   */
  boolean containsAtLeastOneSuccess ();

  /**
   * Check if this group contains no success message.
   * 
   * @return true if no success item is present, false
   *         otherwise.
   */
  boolean containsNoSuccess ();

  /**
   * @return The number of contained success messages. Always ≥ 0.
   */
  @Nonnegative
  int getSuccessCount ();

  /**
   * Check if this group contains only failure messages. If no item is present,
   * false is returned. All error levels except
   * {@link EErrorLevel#SUCCESS} are considered to be a failure!
   * 
   * @return true if at least one item is present, and if all items
   *         have an error level indicating failure, false
   *         otherwise.
   */
  boolean containsOnlyFailure ();

  /**
   * Check if this group contains at least one failure message. All error levels
   * except {@link EErrorLevel#SUCCESS} are considered to be a failure!
   * 
   * @return true if at least one failure item is present,
   *         false otherwise.
   */
  boolean containsAtLeastOneFailure ();

  /**
   * Check if this group contains no failure message. All error levels except
   * {@link EErrorLevel#SUCCESS} are considered to be a failure!
   * 
   * @return true if no failure item is present, false
   *         otherwise.
   */
  boolean containsNoFailure ();

  /**
   * @return The number of contained failure messages. Always ≥ 0.
   */
  @Nonnegative
  int getFailureCount ();

  /**
   * Check if this group contains only error or fatal error messages. If no item
   * is present, false is returned. All error levels ≥
   * {@link EErrorLevel#ERROR} are considered to be an error!
   * 
   * @return true if at least one item is present, and if all items
   *         have an error level indicating error or fatal error,
   *         false otherwise.
   */
  boolean containsOnlyError ();

  /**
   * Check if this group contains at least one error or fatal error message. All
   * error levels ≥ {@link EErrorLevel#ERROR} are considered to be an error!
   * 
   * @return true if at least one error or fatal error item is
   *         present, false otherwise.
   */
  boolean containsAtLeastOneError ();

  /**
   * Check if this group contains no error or fatal error message. All error
   * levels ≥ {@link EErrorLevel#ERROR} are considered to be an error!
   * 
   * @return true if no error or fatal error item is present,
   *         false otherwise.
   */
  boolean containsNoError ();

  /**
   * @return The number of contained error messages. Always ≥ 0. All error
   *         levels ≥ {@link EErrorLevel#ERROR} are considered to be an
   *         error!
   */
  @Nonnegative
  int getErrorCount ();

  /**
   * Get the most severe error level within this group.
   * 
   * @return {@link EErrorLevel#SUCCESS} if no resource error is contained, the
   *         most severe contained error level otherwise.
   */
  @Nonnull
  EErrorLevel getMostSevereErrorLevel ();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy