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 isn't found. Due to limitations with nullable reference types, setting this to false will still mark the return value non-nullable. /// Returns the method wrapper, or null if is false and the field doesn't exist. /// The target field doesn't exist, and is true. 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 isn't found. Due to limitations with nullable reference types, setting this to false will still mark the return value non-nullable. /// Returns the method wrapper, or null if is false and the field doesn't exist. /// The target field doesn't exist, and is true. 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 isn't found. Due to limitations with nullable reference types, setting this to false will still mark the return value non-nullable. /// Returns the method wrapper, or null if is false and the property doesn't exist. /// The target property doesn't exist, and is true. 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 isn't found. Due to limitations with nullable reference types, setting this to false will still mark the return value non-nullable. /// Returns the method wrapper, or null if is false and the property doesn't exist. /// The target property doesn't exist, and is true. IReflectedProperty GetProperty(Type type, string name, bool required = true); /// Get an instance method. /// The object which has the method. /// The method name. /// Whether to throw an exception if the method isn't found. Due to limitations with nullable reference types, setting this to false will still mark the return value non-nullable. /// Returns the method wrapper, or null if is false and the method doesn't exist. /// The target method doesn't exist, and is true. IReflectedMethod GetMethod(object obj, string name, bool required = true); /// Get a static method. /// The type which has the method. /// The method name. /// Whether to throw an exception if the method isn't found. Due to limitations with nullable reference types, setting this to false will still mark the return value non-nullable. /// Returns the method wrapper, or null if is false and the method doesn't exist. /// The target method doesn't exist, and is true. IReflectedMethod GetMethod(Type type, string name, bool required = true); } }