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

org.xins.server.NoSuchFunctionException Maven / Gradle / Ivy

There is a newer version: 3.0
Show newest version
/*
 * $Id: NoSuchFunctionException.java,v 1.18 2010/09/29 17:21:48 agoubard Exp $
 *
 * See the COPYRIGHT file for redistribution and use restrictions.
 */
package org.xins.server;

import org.xins.common.MandatoryArgumentChecker;

/**
 * Exception that indicates that there is no function matching the request.
 *
 * @version $Revision: 1.18 $ $Date: 2010/09/29 17:21:48 $
 * @author Ernst de Haan
 *
 * @since XINS 1.0.0
 */
public final class NoSuchFunctionException extends Exception {

   /**
    * The name of the function.
    */
   private final String _functionName;

   /**
    * Constructs a new NoSuchFunctionException for the specified
    * function name.
    *
    * @param functionName
    *    the name, cannot be null.
    *
    * @throws IllegalArgumentException
    *    if functionName == null.
    */
   NoSuchFunctionException(String functionName)
   throws IllegalArgumentException {
      super(createMessage(functionName));
      _functionName = functionName;
   }

   /**
    * Creates the error message for this exception.
    *
    * @param functionName
    *    the name of the function, or null.
    *
    * @return
    *    the error message, never null.
    *
    * @throws IllegalArgumentException
    *    if functionName == null.
    */
   private static String createMessage(String functionName)
   throws IllegalArgumentException {

      // Function name specified
      MandatoryArgumentChecker.check("functionName", functionName);

      return "The function \"" + functionName + "\" cannot be found.";
   }

   /**
    * Gets the name of the function.
    *
    * @return
    *    the name of the function, never null.
    */
   public String getFunctionName() {
      return _functionName;
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy