Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright 2010 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;
CallbackContext implementation used by CallbackTestClassReloader for adding method-params of classes that have not yet been initialized in the target- context. When the method's declaring classes have been initilized in the target-context the addMethodParams invocations can be passed on to the target-context with the method releaseQue().

Author(s):
Henrik Kaipe
class CallbackContextQue implements CallbackContext {
    private final CallbackContext targetContext;
    private final LinkedList addedMethodsQue/*Method*/ = new LinkedList();
    private final LinkedList addedInjectFieldsQue/*Field*/ = new LinkedList();
    private int methodParameterCount = 0;
    CallbackContextQue(CallbackContext targetContext) {
        this. = targetContext;
    }
    public void addFieldToInject(Field f) {
        .add(f);
    }
    public Iterator iterateFields() {
        return .iterateFields();
    }
    public int addMethodParams(Method m) {
        try {
            return ;
        } finally {
            .add(m);
             += m.getParameterTypes().length;
        }
    }
    public Iterator iterateMethods() {
        return .iterateMethods();
    }
    public List getCallbackRecord() {
        return .getCallbackRecord();
    }
    public void setCallbackRecord(Collection callbackRecord) {
        .setCallbackRecord(callbackRecord);
    }
    void releaseQue() {
        while (false == .isEmpty()) {
            .addMethodParams((Method)
                    .removeFirst());
        }
        while (false == .isEmpty()) {
            .addFieldToInject((Field)
                    .removeFirst());
        }
    }
        return ;
    }
New to GrepCode? Check out our FAQ X