namespace StardewModdingAPI.Framework.Reflection
{
/// Provides an interface for proxied types to create other proxied types.
public sealed class InterfaceProxyGlue
{
private readonly InterfaceProxyFactory Factory;
internal InterfaceProxyGlue(InterfaceProxyFactory factory)
{
this.Factory = factory;
}
/// Creates a new proxied instance by its type name.
/// The full name of the proxy type.
/// The target instance to proxy.
public object CreateInstanceForProxyTypeName(string proxyTypeName, object toProxy)
{
var builder = this.Factory.GetBuilderByProxyTypeName(proxyTypeName);
return builder.CreateInstance(toProxy, this.Factory);
}
}
}