static void validateLifeCycleSignatureExceptParameters ( InterceptorMethodKind kind , String lifeCycle , Method m , boolean ejbClass , J2EEName name , boolean isInterceptor1_2 ) throws EJBConfigurationException { if ( kind == InterceptorMethodKind . AROUND_CONSTRUCT && ejbClass ) { String method = m . toGenericString ( ) ; Tr . error ( tc , "INVALID_AROUND_CONSTRUCT_DEFINITION_CNTR0249E" , new Object [ ] { name . getComponent ( ) , name . getModule ( ) , name . getApplication ( ) , method } ) ; throw new EJBConfigurationException ( "CNTR0249E: The " + name . getComponent ( ) + " enterprise bean in the " + name . getModule ( ) + " module in the " + name . getApplication ( ) + " application specifies the @AroundConstruct annotation on the " + method + " method, but this annotation can only be used by interceptor classes." ) ; } // Get the modifers for the interceptor method and verify that it // is neither final nor static as required by EJB specification. int mod = m . getModifiers ( ) ; if ( Modifier . isFinal ( mod ) || Modifier . isStatic ( mod ) ) { // CNTR0229E: The {0} interceptor method must not be declared as final or static. String method = m . toGenericString ( ) ; Tr . error ( tc , "INVALID_INTERCEPTOR_METHOD_MODIFIER_CNTR0229E" , new Object [ ] { method } ) ; throw new EJBConfigurationException ( lifeCycle + " interceptor \"" + method + "\" must not be declared as final or static." ) ; } // Verify return type is void or Object. Class < ? > returnType = m . getReturnType ( ) ; if ( returnType == java . lang . Void . TYPE || ( isInterceptor1_2 && returnType == Object . class ) ) { // Return type is void as required. } else { // CNTR0231E: The {0} method signature is not valid as // a {1} method of an enterprise bean class. String method = m . toGenericString ( ) ; Tr . error ( tc , "INVALID_LIFECYCLE_SIGNATURE_CNTR0231E" , new Object [ ] { method , lifeCycle } ) ; throw new EJBConfigurationException ( lifeCycle + " interceptor \"" + method + "\" must have void as return type." ) ; } // Per the EJB 3.2 spec, "Note: A lifecycle callback interceptor method // must not throw application exceptions, but it may be declared to // throw checked exceptions including the java.lang.Exception if the // same interceptor method interposes on business or timeout methods in // addition to lifecycle events. If a lifecycle callback interceptor // method returns a value, it is ignored by the container. }
Method for unittesting only