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

net.wpm.codegen.Context Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (C) 2015 SoftIndex LLC.
 *
 * 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 net.wpm.codegen;

import java.util.Map;
import java.util.Set;

import org.objectweb.asm.Type;
import org.objectweb.asm.commons.GeneratorAdapter;
import org.objectweb.asm.commons.Method;

import net.wpm.codegen.utils.DefiningClassLoader;

/**
 * Contains information about a dynamic class
 */
public final class Context {
	private final DefiningClassLoader classLoader;
	private final GeneratorAdapter g;
	private final Type thisType;
	private final Method newMethod;
	private final Set> parentClasses;
	private final Map> staticFields;
	private final Map> thisFields;
	private final Type[] argumentTypes;
	private final Set methods;
	private final Set staticMethods;

	public Context(DefiningClassLoader classLoader, GeneratorAdapter g, Type thisType, Set> parantClasses, Map> thisFields, 
					Map> staticFields, Type[] argumentTypes, Method method, Set methods, Set staticMethods) {
		this.classLoader = classLoader;
		this.g = g;
		this.newMethod = method;
		this.parentClasses = parantClasses;
		this.argumentTypes = argumentTypes;
		this.thisType = thisType;
		this.staticFields = staticFields;
		this.thisFields = thisFields;
		this.methods = methods;
		this.staticMethods = staticMethods;
	}

	public DefiningClassLoader getClassLoader() {
		return classLoader;
	}

	public GeneratorAdapter getGeneratorAdapter() {
		return g;
	}

	public Set> getOtherClasses() {
		return parentClasses;
	}

	public Type getThisType() {
		return thisType;
	}
	
	public Map> getStaticFields() {
		return staticFields;
	}
	
	public Map> getThisFields() {
		return thisFields;
	}

	public Type[] getArgumentTypes() {
		return argumentTypes;
	}

	public Type getArgumentType(int argument) {
		return argumentTypes[argument];
	}

	public Set getStaticMethods() {
		return staticMethods;
	}

	public Set getMethods() {
		return methods;
	}

	public Method getNewMethod() {
		return newMethod;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy