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

net.sf.eBus.messages.UnknownFieldException Maven / Gradle / Ivy

The newest version!
//
// Copyright 2001 - 2008, 2012 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 field is
 * referenced.
 *
 * @author Charles Rapp
 */

public final class UnknownFieldException
    extends RuntimeException
{
//---------------------------------------------------------------
// Member data.
//

    //-----------------------------------------------------------
    // Constants.
    //

    /**
     * This is eBus version 2.1.0.
     */
    private static final long serialVersionUID = 0x050200L;

    //-----------------------------------------------------------
    // Locals.
    //

    /**
     * The message class name.
     */
    private final String mMessageName;

    /**
     * The unknown message field.
     */
    private  final String mField;

//---------------------------------------------------------------
// Member methods.
//

    //-----------------------------------------------------------
    // Constructors.
    //

    /**
     * Constructs an exception for the given message name and
     * field name.
     * @param msgName message name.
     * @param field the unknown field.
     */
    public UnknownFieldException(final String msgName,
                                 final String field)
    {
        super (String.format("%s field %s unknown",
                            msgName,
                            field));

        mMessageName = msgName;
        mField = field;
    } // end of UnknownFieldExceptin(String, String)

    //
    // end of Constructors.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // Get methods.
    //

    /**
     * Returns the message class name.
     * @return the message class name.
     */
    public String messageName()
    {
        return (mMessageName);
    } // end of messageName()

    /**
     * Returns the unknown field name.
     * @return the field name.
     */
    public String field()
    {
        return (mField);
    } // end of field()

    //
    // end of Get methods.
    //-----------------------------------------------------------
} // end of class UnknownFieldException




© 2015 - 2024 Weber Informatics LLC | Privacy Policy