001// SECTION-START[License Header]
002// <editor-fold defaultstate="collapsed" desc=" Generated License ">
003/*
004 *   Java Object Management and Configuration
005 *   Copyright (C) Christian Schulte, 2005-206
006 *   All rights reserved.
007 *
008 *   Redistribution and use in source and binary forms, with or without
009 *   modification, are permitted provided that the following conditions
010 *   are met:
011 *
012 *     o Redistributions of source code must retain the above copyright
013 *       notice, this list of conditions and the following disclaimer.
014 *
015 *     o Redistributions in binary form must reproduce the above copyright
016 *       notice, this list of conditions and the following disclaimer in
017 *       the documentation and/or other materials provided with the
018 *       distribution.
019 *
020 *   THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
021 *   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
022 *   AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
023 *   THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
024 *   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
025 *   NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
026 *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
027 *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
028 *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
029 *   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
030 *
031 *   $JOMC: Invoker.java 4795 2013-04-21 09:09:02Z schulte $
032 *
033 */
034// </editor-fold>
035// SECTION-END
036package org.jomc.spi;
037
038// SECTION-START[Documentation]
039// <editor-fold defaultstate="collapsed" desc=" Generated Documentation ">
040/**
041 * Invokes objects.
042 *
043 * <dl>
044 *   <dt><b>Identifier:</b></dt><dd>org.jomc.spi.Invoker</dd>
045 *   <dt><b>Multiplicity:</b></dt><dd>One</dd>
046 *   <dt><b>Scope:</b></dt><dd>None</dd>
047 * </dl>
048 *
049 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> 1.0
050 * @version 1.0
051 * @see org.jomc.ObjectManager#getObject(java.lang.Class) getObject(Invoker.class)
052 * @see org.jomc.ObjectManager#getObject(java.lang.Class,java.lang.String) getObject(Invoker.class, "<i>implementation name</i>")
053 * @see org.jomc.ObjectManagerFactory
054 */
055// </editor-fold>
056// SECTION-END
057// SECTION-START[Annotations]
058// <editor-fold defaultstate="collapsed" desc=" Generated Annotations ">
059@javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.5", comments = "See http://www.jomc.org/jomc/1.5/jomc-tools-1.5" )
060// </editor-fold>
061// SECTION-END
062public interface Invoker
063{
064    // SECTION-START[Invoker]
065
066    /**
067     * Performs a method invocation on an object.
068     *
069     * @param invocation The invocation to perform.
070     *
071     * @return The return value of the invocation. If the declared return type of the method of the invocation is a
072     * primitive type, then the value returned by this method must be an instance of the corresponding primitive wrapper
073     * class; otherwise, it must be a type assignable to the declared return type of the method of the invocation.
074     * If the value returned by this method is {@code null} and the declared return type of the method of the invocation
075     * is primitive, then a {@code NullPointerException} will be thrown. If the value returned by this method is
076     * otherwise not compatible to the declared return type of the method of the invocation, a
077     * {@code ClassCastException} will be thrown.
078     *
079     * @throws Throwable The exception thrown from the method invocation. The exception's type must be assignable
080     * either to any of the exception types declared in the {@code throws} clause of the method of the invocation or to
081     * the unchecked exception types {@code java.lang.RuntimeException} or {@code java.lang.Error}.
082     * If a checked exception is thrown by this method that is not assignable to any of the exception types declared in
083     * the {@code throws} clause of the method of the invocation, then an {@code UndeclaredThrowableException}
084     * containing the exception that was thrown by this method will be thrown.
085     *
086     * @see java.lang.reflect.UndeclaredThrowableException
087     */
088    Object invoke( Invocation invocation ) throws Throwable;
089
090    // SECTION-END
091}