All Downloads are FREE. Search and download functionalities are using the official Maven repository.

soot.jimple.infoflow.android.entryPointCreators.components.ComponentEntryPointCollection Maven / Gradle / Ivy

package soot.jimple.infoflow.android.entryPointCreators.components;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import soot.SootClass;
import soot.SootField;
import soot.SootMethod;

/**
 * Mapping class for associating components with the data object for their
 * respective entry point
 * 
 * @author Steven Arzt
 *
 */
public class ComponentEntryPointCollection {

	protected Map componentToEntryPointInfo = new HashMap<>();

	public void put(SootClass component, ComponentEntryPointInfo info) {
		componentToEntryPointInfo.put(component, info);
	}

	public void put(SootClass component, SootMethod lifecycleMethod) {
		componentToEntryPointInfo.put(component, new ComponentEntryPointInfo(lifecycleMethod));
	}

	public ComponentEntryPointInfo get(SootClass component) {
		return componentToEntryPointInfo.get(component);
	}

	public Collection getLifecycleMethods() {
		List list = new ArrayList<>();
		for (ComponentEntryPointInfo info : componentToEntryPointInfo.values())
			list.add(info.getEntryPoint());
		return list;
	}

	public Collection getAdditionalFields() {
		List list = new ArrayList<>();
		for (ComponentEntryPointInfo info : componentToEntryPointInfo.values())
			list.addAll(info.getAdditionalFields());
		return list;
	}

	public SootMethod getEntryPoint(SootClass component) {
		ComponentEntryPointInfo info = componentToEntryPointInfo.get(component);
		return info == null ? null : info.getEntryPoint();
	}

	public void clear() {
		componentToEntryPointInfo.clear();
	}

	public boolean hasEntryPointForComponent(SootClass component) {
		return componentToEntryPointInfo.containsKey(component);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy