private static void RemoveExplicitlyIgnoredMembers(Type type, IMethodRemover methodRemover) { foreach (var method in type.GetMethods().Where(m => m.GetCustomAttribute <NakedObjectsIgnoreAttribute>() is not null)) { methodRemover.SafeRemoveMethod(method); } }
public override IImmutableDictionary <string, ITypeSpecBuilder> Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification, IImmutableDictionary <string, ITypeSpecBuilder> metamodel) { var method = MethodHelpers.FindMethod(reflector, type, MethodType.Class, RecognisedMethodsAndPrefixes.MenuMethod, null, null); methodRemover.SafeRemoveMethod(method); var facet = method is not null ? (IFacet) new MenuFacetViaMethod(method, specification) : new MenuFacetDefault(specification); FacetUtils.AddFacet(facet); return(metamodel); }
public static void ProcessSystemType(Type type, IMethodRemover methodRemover, ISpecification holder) { var typeToMethods = new Dictionary <Type, MethodInfo[]>(); InitForType(type, typeToMethods); foreach (var method in typeToMethods[type]) { methodRemover.SafeRemoveMethod(method); } }
public override IImmutableDictionary <string, ITypeSpecBuilder> Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification, IImmutableDictionary <string, ITypeSpecBuilder> metamodel) { if (IsDynamicProxyType(type)) { foreach (var method in type.GetMethods().Join(MethodsToRemove, mi => mi.Name, s => s, (mi, s) => mi)) { methodRemover.SafeRemoveMethod(method); } } return(metamodel); }
public override IImmutableDictionary <string, ITypeSpecBuilder> Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification, IImmutableDictionary <string, ITypeSpecBuilder> metamodel) { var method = MethodHelpers.FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.IconNameMethod, typeof(string), Type.EmptyTypes); var attribute = type.GetCustomAttribute <IconNameAttribute>(); methodRemover.SafeRemoveMethod(method); if (method is not null) { FacetUtils.AddFacet(new IconFacetViaMethod(method, specification, attribute?.Value, Logger <IconFacetViaMethod>())); } else { FacetUtils.AddFacet(Create(attribute, specification)); } return(metamodel); }