using System;
namespace StardewModdingAPI
{
/// Provides an API for accessing inaccessible code.
public interface IReflectionHelper : IModLinked
{
/*********
** Public methods
*********/
/// Get an instance field.
/// The field type.
/// The object which has the field.
/// The field name.
/// Whether to throw an exception if the field is not found.
IReflectedField GetField(object obj, string name, bool required = true);
/// Get a static field.
/// The field type.
/// The type which has the field.
/// The field name.
/// Whether to throw an exception if the field is not found.
IReflectedField GetField(Type type, string name, bool required = true);
/// Get an instance property.
/// The property type.
/// The object which has the property.
/// The property name.
/// Whether to throw an exception if the property is not found.
IReflectedProperty GetProperty(object obj, string name, bool required = true);
/// Get a static property.
/// The property type.
/// The type which has the property.
/// The property name.
/// Whether to throw an exception if the property is not found.
IReflectedProperty GetProperty(Type type, string name, bool required = true);
/// Get an instance method.
/// The object which has the method.
/// The field name.
/// Whether to throw an exception if the field is not found.
IReflectedMethod GetMethod(object obj, string name, bool required = true);
/// Get a static method.
/// The type which has the method.
/// The field name.
/// Whether to throw an exception if the field is not found.
IReflectedMethod GetMethod(Type type, string name, bool required = true);
/*****
** Obsolete
*****/
/// Get a private instance field.
/// The field type.
/// The object which has the field.
/// The field name.
/// Whether to throw an exception if the private field is not found.
[Obsolete("Use " + nameof(IReflectionHelper) + "." + nameof(IReflectionHelper.GetField) + " instead")]
IPrivateField GetPrivateField(object obj, string name, bool required = true);
/// Get a private static field.
/// The field type.
/// The type which has the field.
/// The field name.
/// Whether to throw an exception if the private field is not found.
[Obsolete("Use " + nameof(IReflectionHelper) + "." + nameof(IReflectionHelper.GetField) + " instead")]
IPrivateField GetPrivateField(Type type, string name, bool required = true);
/// Get a private instance property.
/// The property type.
/// The object which has the property.
/// The property name.
/// Whether to throw an exception if the private property is not found.
[Obsolete("Use " + nameof(IReflectionHelper) + "." + nameof(IReflectionHelper.GetProperty) + " instead")]
IPrivateProperty GetPrivateProperty(object obj, string name, bool required = true);
/// Get a private static property.
/// The property type.
/// The type which has the property.
/// The property name.
/// Whether to throw an exception if the private property is not found.
[Obsolete("Use " + nameof(IReflectionHelper) + "." + nameof(IReflectionHelper.GetProperty) + " instead")]
IPrivateProperty GetPrivateProperty(Type type, string name, bool required = true);
/// Get the value of a private instance field.
/// The field type.
/// The object which has the field.
/// The field name.
/// Whether to throw an exception if the private field is not found.
/// This is a shortcut for followed by .
[Obsolete("Use " + nameof(IReflectionHelper) + "." + nameof(IReflectionHelper.GetField) + " or " + nameof(IReflectionHelper) + "." + nameof(IReflectionHelper.GetProperty) + " instead")]
TValue GetPrivateValue(object obj, string name, bool required = true);
/// Get the value of a private static field.
/// The field type.
/// The type which has the field.
/// The field name.
/// Whether to throw an exception if the private field is not found.
/// This is a shortcut for followed by .
[Obsolete("Use " + nameof(IReflectionHelper) + "." + nameof(IReflectionHelper.GetField) + " or " + nameof(IReflectionHelper) + "." + nameof(IReflectionHelper.GetProperty) + " instead")]
TValue GetPrivateValue(Type type, string name, bool required = true);
/// Get a private instance method.
/// The object which has the method.
/// The field name.
/// Whether to throw an exception if the private field is not found.
[Obsolete("Use " + nameof(IReflectionHelper) + "." + nameof(IReflectionHelper.GetMethod) + " instead")]
IPrivateMethod GetPrivateMethod(object obj, string name, bool required = true);
/// Get a private static method.
/// The type which has the method.
/// The field name.
/// Whether to throw an exception if the private field is not found.
[Obsolete("Use " + nameof(IReflectionHelper) + "." + nameof(IReflectionHelper.GetMethod) + " instead")]
IPrivateMethod GetPrivateMethod(Type type, string name, bool required = true);
}
}