Class PropertySpec
- Namespace
- AsmLocator
- Assembly
- AsmLocator.dll
Describes constraints used to match a property definition.
public sealed record PropertySpec : IEquatable<PropertySpec>
- Inheritance
-
PropertySpec
- Implements
- Inherited Members
Constructors
PropertySpec()
public PropertySpec()
Properties
Attribute
The custom attribute type full-name matcher.
public StringMatcher? Attribute { get; init; }
Property Value
HasGetter
Whether the property must have a getter.
public bool? HasGetter { get; init; }
Property Value
- bool?
HasSetter
Whether the property must have a setter.
public bool? HasSetter { get; init; }
Property Value
- bool?
IsStatic
Whether the property accessors are static; the getter is preferred when present, otherwise the setter is inspected.
public bool? IsStatic { get; init; }
Property Value
- bool?
Name
The member name matcher. When null, the name is not used as a constraint.
public StringMatcher? Name { get; init; }
Property Value
PropertyType
The property type full-name matcher.
public StringMatcher? PropertyType { get; init; }
Property Value
Where
An optional custom predicate applied after the built-in constraints.
public Func<PropertyDefinition, bool>? Where { get; init; }
Property Value
Methods
ByName(StringMatcher)
Creates a specification constrained by member name.
public static PropertySpec ByName(StringMatcher name)
Parameters
nameStringMatcherThe name matcher for the target member.
Returns
- PropertySpec
A new specification with the described constraints.
Equals(PropertySpec?)
public bool Equals(PropertySpec? other)
Parameters
otherPropertySpec
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
Matches(PropertyDefinition)
Returns whether the supplied candidate satisfies all constraints configured in this specification.
public bool Matches(PropertyDefinition property)
Parameters
propertyPropertyDefinitionThe candidate AsmResolver property definition.
Returns
Of(StringMatcher, StringMatcher?)
When only a name is supplied, matches by name; when a property type is supplied, also matches its type.
public static PropertySpec Of(StringMatcher name, StringMatcher? propertyType = null)
Parameters
nameStringMatcherThe name matcher for the target member.
propertyTypeStringMatcherAn optional matcher for the property type full name.
Returns
- PropertySpec
A new specification with the described constraints.
ToString()
Returns a readable representation of this object.
public override string ToString()
Returns
- string
A readable description.
Operators
operator ==(PropertySpec?, PropertySpec?)
public static bool operator ==(PropertySpec? left, PropertySpec? right)
Parameters
leftPropertySpecrightPropertySpec
Returns
implicit operator PropertySpec(string)
Converts a string into a PropertySpec that matches the property name.
public static implicit operator PropertySpec(string name)
Parameters
namestringThe name matcher for the target member.
Returns
- PropertySpec
The specification created from the supplied string.
operator !=(PropertySpec?, PropertySpec?)
public static bool operator !=(PropertySpec? left, PropertySpec? right)
Parameters
leftPropertySpecrightPropertySpec