system.reflection.Module Maven / Gradle / Ivy
/*
* MIT License
*
* Copyright (c) 2024 MASES s.r.l.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**************************************************************************************
*
* This code was generated from a template using JCOReflector v. 1.15.0.0
*
* Manual changes to this file may cause unexpected behavior in your application.
* Manual changes to this file will be overwritten if the code is regenerated.
*
*************************************************************************************/
package system.reflection;
import org.mases.jcobridge.*;
import org.mases.jcobridge.netreflection.*;
import java.util.ArrayList;
// Import section
import system.reflection.FieldInfo;
import system.reflection.BindingFlags;
import system.reflection.MemberInfo;
import system.reflection.MethodBase;
import system.reflection.MethodInfo;
import system.reflection.Binder;
import system.reflection.CallingConventions;
import system.reflection.ParameterModifier;
import system.security.cryptography.x509certificates.X509Certificate;
import system.reflection.TypeFilter;
import system.runtime.serialization.SerializationInfo;
import system.runtime.serialization.StreamingContext;
import system.reflection.PortableExecutableKinds;
import system.reflection.ImageFileMachine;
import system.Guid;
import system.UInt32;
import system.ModuleHandle;
import system.reflection.Assembly;
/**
* The base .NET class managing System.Reflection.Module, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
*
*
* .NET documentation at https://docs.microsoft.com/en-us/dotnet/api/System.Reflection.Module
*
*
* Powered by JCOBridge: more info at https://www.jcobridge.com
*
* @author MASES s.r.l https://masesgroup.com
* @version 1.15.0.0
*/
public class Module extends NetObject {
/**
* Fully assembly qualified name: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
*/
public static final String assemblyFullName = "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
/**
* Assembly name: mscorlib
*/
public static final String assemblyShortName = "mscorlib";
/**
* Qualified class name: System.Reflection.Module
*/
public static final String className = "System.Reflection.Module";
static JCOBridge bridge = JCOBridgeInstance.getInstance(assemblyFullName);
/**
* The type managed from JCOBridge. See {@link JCType}
*/
public static JCType classType = createType();
static JCEnum enumInstance = null;
JCObject classInstance = null;
static JCType createType() {
try {
String classToCreate = className + ", "
+ (JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName);
if (JCOReflector.getDebug())
JCOReflector.writeLog("Creating %s", classToCreate);
JCType typeCreated = bridge.GetType(classToCreate);
if (JCOReflector.getDebug())
JCOReflector.writeLog("Created: %s",
(typeCreated != null) ? typeCreated.toString() : "Returned null value");
return typeCreated;
} catch (JCException e) {
JCOReflector.writeLog(e);
return null;
}
}
void addReference(String ref) throws Throwable {
try {
bridge.AddReference(ref);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
/**
* Internal constructor. Use with caution
*/
public Module(java.lang.Object instance) throws Throwable {
super(instance);
if (instance instanceof JCObject) {
classInstance = (JCObject) instance;
} else
throw new Exception("Cannot manage object, it is not a JCObject");
}
public String getJCOAssemblyName() {
return assemblyFullName;
}
public String getJCOClassName() {
return className;
}
public String getJCOObjectName() {
return className + ", " + (JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName);
}
public java.lang.Object getJCOInstance() {
return classInstance;
}
public void setJCOInstance(JCObject instance) {
classInstance = instance;
super.setJCOInstance(classInstance);
}
public JCType getJCOType() {
return classType;
}
/**
* Try to cast the {@link IJCOBridgeReflected} instance into {@link Module}, a cast assert is made to check if types are compatible.
* @param from {@link IJCOBridgeReflected} instance to be casted
* @return {@link Module} instance
* @throws java.lang.Throwable in case of error during cast operation
*/
public static Module cast(IJCOBridgeReflected from) throws Throwable {
NetType.AssertCast(classType, from);
return new Module(from.getJCOInstance());
}
// Constructors section
public Module() throws Throwable {
}
// Methods section
public boolean IsDefined(NetType attributeType, boolean inherit) throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (boolean)classInstance.Invoke("IsDefined", attributeType == null ? null : attributeType.getJCOInstance(), inherit);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public boolean IsResource() throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (boolean)classInstance.Invoke("IsResource");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public byte[] ResolveSignature(int metadataToken) throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
ArrayList resultingArrayList = new ArrayList();
JCObject resultingObjects = (JCObject)classInstance.Invoke("ResolveSignature", metadataToken);
for (java.lang.Object resultingObject : resultingObjects) {
resultingArrayList.add(resultingObject);
}
byte[] resultingArray = new byte[resultingArrayList.size()];
for(int indexResolveSignature = 0; indexResolveSignature < resultingArrayList.size(); indexResolveSignature++ ) {
resultingArray[indexResolveSignature] = (byte)resultingArrayList.get(indexResolveSignature);
}
return resultingArray;
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public NetObject[] GetCustomAttributes(boolean inherit) throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
ArrayList resultingArrayList = new ArrayList();
JCObject resultingObjects = (JCObject)classInstance.Invoke("GetCustomAttributes", inherit);
for (java.lang.Object resultingObject : resultingObjects) {
resultingArrayList.add(new NetObject(resultingObject));
}
NetObject[] resultingArray = new NetObject[resultingArrayList.size()];
resultingArray = resultingArrayList.toArray(resultingArray);
return resultingArray;
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public NetObject[] GetCustomAttributes(NetType attributeType, boolean inherit) throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
ArrayList resultingArrayList = new ArrayList();
JCObject resultingObjects = (JCObject)classInstance.Invoke("GetCustomAttributes", attributeType == null ? null : attributeType.getJCOInstance(), inherit);
for (java.lang.Object resultingObject : resultingObjects) {
resultingArrayList.add(new NetObject(resultingObject));
}
NetObject[] resultingArray = new NetObject[resultingArrayList.size()];
resultingArray = resultingArrayList.toArray(resultingArray);
return resultingArray;
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public FieldInfo GetField(java.lang.String name) throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objGetField = (JCObject)classInstance.Invoke("GetField", name);
return new FieldInfo(objGetField);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public FieldInfo GetField(java.lang.String name, BindingFlags bindingAttr) throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objGetField = (JCObject)classInstance.Invoke("GetField", name, bindingAttr == null ? null : bindingAttr.getJCOInstance());
return new FieldInfo(objGetField);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public FieldInfo ResolveField(int metadataToken) throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objResolveField = (JCObject)classInstance.Invoke("ResolveField", metadataToken);
return new FieldInfo(objResolveField);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public FieldInfo ResolveField(int metadataToken, NetType[] genericTypeArguments, NetType[] genericMethodArguments) throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objResolveField = (JCObject)classInstance.Invoke("ResolveField", metadataToken, toObjectFromArray(genericTypeArguments), toObjectFromArray(genericMethodArguments));
return new FieldInfo(objResolveField);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public FieldInfo[] GetFields() throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
ArrayList resultingArrayList = new ArrayList();
JCObject resultingObjects = (JCObject)classInstance.Invoke("GetFields");
for (java.lang.Object resultingObject : resultingObjects) {
resultingArrayList.add(new FieldInfo(resultingObject));
}
FieldInfo[] resultingArray = new FieldInfo[resultingArrayList.size()];
resultingArray = resultingArrayList.toArray(resultingArray);
return resultingArray;
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public FieldInfo[] GetFields(BindingFlags bindingFlags) throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
ArrayList resultingArrayList = new ArrayList();
JCObject resultingObjects = (JCObject)classInstance.Invoke("GetFields", bindingFlags == null ? null : bindingFlags.getJCOInstance());
for (java.lang.Object resultingObject : resultingObjects) {
resultingArrayList.add(new FieldInfo(resultingObject));
}
FieldInfo[] resultingArray = new FieldInfo[resultingArrayList.size()];
resultingArray = resultingArrayList.toArray(resultingArray);
return resultingArray;
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public MemberInfo ResolveMember(int metadataToken) throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objResolveMember = (JCObject)classInstance.Invoke("ResolveMember", metadataToken);
return new MemberInfo(objResolveMember);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public MemberInfo ResolveMember(int metadataToken, NetType[] genericTypeArguments, NetType[] genericMethodArguments) throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objResolveMember = (JCObject)classInstance.Invoke("ResolveMember", metadataToken, toObjectFromArray(genericTypeArguments), toObjectFromArray(genericMethodArguments));
return new MemberInfo(objResolveMember);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public MethodBase ResolveMethod(int metadataToken) throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objResolveMethod = (JCObject)classInstance.Invoke("ResolveMethod", metadataToken);
return new MethodBase(objResolveMethod);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public MethodBase ResolveMethod(int metadataToken, NetType[] genericTypeArguments, NetType[] genericMethodArguments) throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objResolveMethod = (JCObject)classInstance.Invoke("ResolveMethod", metadataToken, toObjectFromArray(genericTypeArguments), toObjectFromArray(genericMethodArguments));
return new MethodBase(objResolveMethod);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public MethodInfo GetMethod(java.lang.String name) throws Throwable, system.ArgumentNullException, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objGetMethod = (JCObject)classInstance.Invoke("GetMethod", name);
return new MethodInfo(objGetMethod);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public MethodInfo GetMethod(java.lang.String name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, NetType[] types, ParameterModifier[] modifiers) throws Throwable, system.ArgumentNullException, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objGetMethod = (JCObject)classInstance.Invoke("GetMethod", name, bindingAttr == null ? null : bindingAttr.getJCOInstance(), binder == null ? null : binder.getJCOInstance(), callConvention == null ? null : callConvention.getJCOInstance(), toObjectFromArray(types), toObjectFromArray(modifiers));
return new MethodInfo(objGetMethod);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public MethodInfo GetMethod(java.lang.String name, NetType[] types) throws Throwable, system.ArgumentNullException, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objGetMethod = (JCObject)classInstance.Invoke("GetMethod", name, toObjectFromArray(types));
return new MethodInfo(objGetMethod);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public MethodInfo[] GetMethods() throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
ArrayList resultingArrayList = new ArrayList();
JCObject resultingObjects = (JCObject)classInstance.Invoke("GetMethods");
for (java.lang.Object resultingObject : resultingObjects) {
resultingArrayList.add(new MethodInfo(resultingObject));
}
MethodInfo[] resultingArray = new MethodInfo[resultingArrayList.size()];
resultingArray = resultingArrayList.toArray(resultingArray);
return resultingArray;
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public MethodInfo[] GetMethods(BindingFlags bindingFlags) throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
ArrayList resultingArrayList = new ArrayList();
JCObject resultingObjects = (JCObject)classInstance.Invoke("GetMethods", bindingFlags == null ? null : bindingFlags.getJCOInstance());
for (java.lang.Object resultingObject : resultingObjects) {
resultingArrayList.add(new MethodInfo(resultingObject));
}
MethodInfo[] resultingArray = new MethodInfo[resultingArrayList.size()];
resultingArray = resultingArrayList.toArray(resultingArray);
return resultingArray;
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public X509Certificate GetSignerCertificate() throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objGetSignerCertificate = (JCObject)classInstance.Invoke("GetSignerCertificate");
return new X509Certificate(objGetSignerCertificate);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public java.lang.String ResolveString(int metadataToken) throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (java.lang.String)classInstance.Invoke("ResolveString", metadataToken);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public NetType GetType(java.lang.String className) throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objGetType = (JCObject)classInstance.Invoke("GetType", className);
return new NetType(objGetType);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public NetType GetType(java.lang.String className, boolean ignoreCase) throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objGetType = (JCObject)classInstance.Invoke("GetType", className, ignoreCase);
return new NetType(objGetType);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public NetType GetType(java.lang.String className, boolean throwOnError, boolean ignoreCase) throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objGetType = (JCObject)classInstance.Invoke("GetType", className, throwOnError, ignoreCase);
return new NetType(objGetType);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public NetType ResolveType(int metadataToken) throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objResolveType = (JCObject)classInstance.Invoke("ResolveType", metadataToken);
return new NetType(objResolveType);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public NetType ResolveType(int metadataToken, NetType[] genericTypeArguments, NetType[] genericMethodArguments) throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objResolveType = (JCObject)classInstance.Invoke("ResolveType", metadataToken, toObjectFromArray(genericTypeArguments), toObjectFromArray(genericMethodArguments));
return new NetType(objResolveType);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public NetType[] FindTypes(TypeFilter filter, NetObject filterCriteria) throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
ArrayList resultingArrayList = new ArrayList();
JCObject resultingObjects = (JCObject)classInstance.Invoke("FindTypes", filter, filterCriteria == null ? null : filterCriteria.getJCOInstance());
for (java.lang.Object resultingObject : resultingObjects) {
resultingArrayList.add(new NetType(resultingObject));
}
NetType[] resultingArray = new NetType[resultingArrayList.size()];
resultingArray = resultingArrayList.toArray(resultingArray);
return resultingArray;
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public NetType[] GetTypes() throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
ArrayList resultingArrayList = new ArrayList();
JCObject resultingObjects = (JCObject)classInstance.Invoke("GetTypes");
for (java.lang.Object resultingObject : resultingObjects) {
resultingArrayList.add(new NetType(resultingObject));
}
NetType[] resultingArray = new NetType[resultingArrayList.size()];
resultingArray = resultingArrayList.toArray(resultingArray);
return resultingArray;
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void GetObjectData(SerializationInfo info, StreamingContext context) throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Invoke("GetObjectData", info == null ? null : info.getJCOInstance(), context == null ? null : context.getJCOInstance());
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void GetPEKind(JCORefOut peKind, JCORefOut machine) throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Invoke("GetPEKind", peKind.getJCRefOut(), machine.getJCRefOut());
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
/**
* @deprecated Not for public use because the method is implemented in .NET with an explicit interface.
* Use the static To_Module method available in _Module to obtain an object with an invocable method
*/
@Deprecated
public void GetTypeInfoCount(JCORefOut pcTInfo) throws Throwable {
throw new UnsupportedOperationException("Not for public use because the method is implemented with an explicit interface. Use To_Module to obtain the full interface.");
}
// Properties section
public int getMDStreamVersion() throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (int)classInstance.Get("MDStreamVersion");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public int getMetadataToken() throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (int)classInstance.Get("MetadataToken");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public Guid getModuleVersionId() throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject val = (JCObject)classInstance.Get("ModuleVersionId");
return new Guid(val);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public ModuleHandle getModuleHandle() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject val = (JCObject)classInstance.Get("ModuleHandle");
return new ModuleHandle(val);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public Assembly getAssembly() throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject val = (JCObject)classInstance.Get("Assembly");
return new Assembly(val);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public java.lang.String getFullyQualifiedName() throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (java.lang.String)classInstance.Get("FullyQualifiedName");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public java.lang.String getName() throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (java.lang.String)classInstance.Get("Name");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public java.lang.String getScopeName() throws Throwable, system.NotImplementedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (java.lang.String)classInstance.Get("ScopeName");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
// Instance Events section
}