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

io.github.jdcmp.codegen.ClassDefiner Maven / Gradle / Ivy

There is a newer version: 0.3
Show newest version
package io.github.jdcmp.codegen;

import io.github.jdcmp.api.documentation.Immutable;
import io.github.jdcmp.api.documentation.ThreadSafe;

import java.lang.invoke.MethodHandles.Lookup;
import java.util.Objects;

@ThreadSafe
interface ClassDefiner {

	 Class defineClass(ClassDefinition classDefinition);

	@Immutable
	final class ClassDefinition {

		private final byte[] bytes;

		private final String name;

		private final Lookup host;

		public ClassDefinition(byte[] bytes, String name, Lookup host) {
			this.bytes = bytes.clone();
			this.name = Objects.requireNonNull(name);
			this.host = Objects.requireNonNull(host);
		}

		public byte[] getBytes() {
			return bytes.clone();
		}

		public String getName() {
			return name;
		}

		public Lookup getHost() {
			return host;
		}

	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy