IMonitorFactory.java

/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * 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 androidx.test.jank;

import androidx.test.annotation.Beta;

import java.lang.reflect.Method;
import java.util.List;

/**
 * An interface used to define a class that constructs {@link IMonitor}s for test methods.
 * Implementing classes must have a public constructor that takes an {@link Instrumentation}
 * instance as the sole argument.
 */
@Beta
public interface IMonitorFactory {

    /**
     * Returns a list of {@link IMonitor}s that should be used to monitor the given test method.
     *
     * @param method The test method to monitor.
     * @param test An instance of the class to which {@code method} belongs.
     * @return A list of {@link IMonitor}s that should be used to monitor the given test method.
     */
    public List<IMonitor> getMonitors(Method method, Object test);
}