
net.sf.eBus.messages.UnknownMessageException Maven / Gradle / Ivy
The newest version!
//
// Copyright 2001 - 2008, 2015 Charles W. Rapp
//
// 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 net.sf.eBus.messages;
/**
* This exception is thrown when an unknown message identifier
* is referenced. This will only occur when deserializing an
* incoming message.
*
* @author Charles Rapp
*/
public final class UnknownMessageException
extends RuntimeException
{
//---------------------------------------------------------------
// Member data.
//
//-----------------------------------------------------------
// Constants.
//
/**
* This is eBus version 2.1.0.
*/
private static final long serialVersionUID = 0x050200L;
//-----------------------------------------------------------
// Locals.
//
/**
* The message class name causing this exception.
*/
private final String mClass;
//---------------------------------------------------------------
// Member methods.
//
//-----------------------------------------------------------
// Constructors.
//
/**
* Constructs an exception for the given message identifier.
* @param clazz the message class name.
*/
public UnknownMessageException(final String clazz)
{
super (String.format("%s unknown", clazz));
mClass = clazz;
} // end of UnknownMessageException(String)
/**
* Constructs an exception for the given message identifier
* and the exception explaining when this message is unknown.
* @param clazz the message class name.
* @param cause the exception which caused this exception.
*/
public UnknownMessageException(final String clazz,
final Throwable cause)
{
super (String.format("%s unknown", clazz), cause);
mClass = clazz;
} // end of UnknownMessageException(String, Throwable)
//
// end of Constructors.
//-----------------------------------------------------------
//-----------------------------------------------------------
// Get methods.
//
/**
* Returns the message class name.
* @return the message class name.
*/
public String messageClass()
{
return (mClass);
} // end of messageClass()
//
// end of Get methods.
//-----------------------------------------------------------
} // end of class UnknownMessageException
© 2015 - 2025 Weber Informatics LLC | Privacy Policy