View Javadoc

1   // SECTION-START[License Header]
2   // <editor-fold defaultstate="collapsed" desc=" Generated License ">
3   /*
4    *   Copyright (c) 2010 The JOMC Project
5    *   Copyright (c) 2005 Christian Schulte <cs@jomc.org>
6    *   All rights reserved.
7    *
8    *   Redistribution and use in source and binary forms, with or without
9    *   modification, are permitted provided that the following conditions
10   *   are met:
11   *
12   *     o Redistributions of source code must retain the above copyright
13   *       notice, this list of conditions and the following disclaimer.
14   *
15   *     o Redistributions in binary form must reproduce the above copyright
16   *       notice, this list of conditions and the following disclaimer in
17   *       the documentation and/or other materials provided with the
18   *       distribution.
19   *
20   *   THIS SOFTWARE IS PROVIDED BY THE JOMC PROJECT AND CONTRIBUTORS "AS IS"
21   *   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22   *   THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23   *   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE JOMC PROJECT OR
24   *   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25   *   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26   *   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27   *   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28   *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29   *   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
30   *   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31   *
32   *   $Id: Invoker.java 1306 2010-01-16 14:28:11Z schulte2005 $
33   *
34   */
35  // </editor-fold>
36  // SECTION-END
37  package org.jomc.spi;
38  
39  // SECTION-START[Documentation]
40  // <editor-fold defaultstate="collapsed" desc=" Generated Documentation ">
41  /**
42   * Invokes objects.
43   * <p>This specification declares a multiplicity of {@code One}.
44   * An application assembler is required to provide no more than one implementation of this specification (including none).
45   * Use of class {@link org.jomc.ObjectManager ObjectManager} is supported for getting that implementation.<pre>
46   * Invoker object = (Invoker) ObjectManagerFactory.getObjectManager( getClassLoader() ).getObject( Invoker.class );
47   * </pre>
48   * </p>
49   *
50   * <p>This specification does not apply to any scope. A new object is returned whenever requested.</p>
51   *
52   * @author <a href="mailto:cs@jomc.org">Christian Schulte</a> 1.0
53   * @version $Id: Invoker.java 1306 2010-01-16 14:28:11Z schulte2005 $
54   */
55  // </editor-fold>
56  // SECTION-END
57  // SECTION-START[Annotations]
58  // <editor-fold defaultstate="collapsed" desc=" Generated Annotations ">
59  @javax.annotation.Generated( value = "org.jomc.tools.JavaSources",
60                               comments = "See http://jomc.sourceforge.net/jomc/1.0-alpha-14/jomc-tools" )
61  // </editor-fold>
62  // SECTION-END
63  public interface Invoker
64  {
65      // SECTION-START[InvocationHandler]
66  
67      /**
68       * Performs a method invocation on an object.
69       *
70       * @param invocation The invocation to perform.
71       *
72       * @return The return value of the invocation. If the declared return type of the method of the invocation is a
73       * primitive type, then the value returned by this method must be an instance of the corresponding primitive wrapper
74       * class; otherwise, it must be a type assignable to the declared return type of the method of the invocation.
75       * If the value returned by this method is {@code null} and the declared return type of the method of the invocation
76       * is primitive, then a {@code NullPointerException} will be thrown. If the value returned by this method is
77       * otherwise not compatible to the declared return type of the method of the invocation, a
78       * {@code ClassCastException} will be thrown.
79       *
80       * @throws Throwable The exception thrown from the method invocation. The exception's type must be assignable
81       * either to any of the exception types declared in the {@code throws} clause of the method of the invocation or to
82       * the unchecked exception types {@code java.lang.RuntimeException} or {@code java.lang.Error}.
83       * If a checked exception is thrown by this method that is not assignable to any of the exception types declared in
84       * the {@code throws} clause of the method of the invocation, then an {@code UndeclaredThrowableException}
85       * containing the exception that was thrown by this method will be thrown.
86       *
87       * @see java.lang.reflect.UndeclaredThrowableException
88       */
89      Object invoke( Invocation invocation ) throws Throwable;
90  
91      // SECTION-END
92  }