Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2013 the original author or authors.
   *
   * 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 org.callbackparams.internal.template;
 
 import java.util.List;
 import java.util.Map;
Wraps an array of all combined values that are to be used for a single test-run. This array is also referred to as a callback-record throughout the CallbackParams documentation - hence the name of this class.

Author(s):
Henrik Kaipe
 
 public class CallbackRecord {
 
     private final List callbackRecord;
     private final Map latestCallbackResults = new IdentityHashMap();
     private final CallbackControlPanel ccp = new CallbackControlPanel() {
         public List getCurrentCallbackRecord() {
             return ;
         }
         public Map getLatestCallbackResults() {
             return ;
         }
     };
 
     public CallbackRecord(List callbackRecord) {
         this. = callbackRecord;
     }
 
         return ;
     }
 
     public InvocationHandler newCallbackInvoker(final CallbackRef callbackRef) {
         return new InvocationHandler() {
             
             public Object invoke(Object oMethod mObject[] args)
             throws Throwable {
                 if (false == m.isAccessible()) {
                     m.setAccessible(true);
                 }
 
                 final ReturnValueDigester returnValueDigester =
                         ReturnValueDigester.newInstance(margs);
                 for (Iterator i = .iterator(); i.hasNext();) {
                     final Object callbackRecordElement = i.next();
                     if (null == callbackRecordElement) {
                         continue;
                     }
                     final Object targetCallbackInstance =
                             callbackRef.asCallback(callbackRecordElement);
                     if (null == targetCallbackInstance) {
                         continue;
                     }
 
                     try {
                         Object returnValue = m.invoke(
                                 targetCallbackInstance,
                                 returnValueDigester.getArguments());                                
                         returnValueDigester.digestNext(
                                 callbackRecordElementreturnValue);
 
                     } catch (final InvocationTargetException ite) {
                         final Throwable targetProblem = ite.getTargetException();
                         try {
                             returnValueDigester
                                     .updateLatestCallbackResultsInCallbackControlPanel(
                                     );
                             
                                     .put(callbackRecordElementnew Object() {
                                 public String toString() {
                                     return targetProblem.getClass().getName()
                                             + " was thrown from "
                                             + targetCallbackInstance
                                             + ": " + targetProblem.getMessage();
                                 }
                             });
                        } finally {
                            throw targetProblem;
                        }
                    }
                }
                returnValueDigester
                        .updateLatestCallbackResultsInCallbackControlPanel(
                        );
                return returnValueDigester.returnValue();
            }
        };
    }
New to GrepCode? Check out our FAQ X