public override IList <PropertyInfo> FindProperties(IList <PropertyInfo> candidates, IClassStrategy classStrategy) { return(candidates.Where(property => property.GetGetMethod() != null && property.GetCustomAttribute <NakedObjectsIgnoreAttribute>() == null && classStrategy.IsTypeToBeIntrospected(property.PropertyType) && !CollectionUtils.IsQueryable(property.PropertyType)).ToList()); }
protected IList <PropertyInfo> PropertiesToBeIntrospected(IList <PropertyInfo> candidates, IClassStrategy classStrategy) { return(candidates.Where(property => property.GetGetMethod() != null && classStrategy.IsTypeToBeIntrospected(property.PropertyType) && IsPropertyIncluded(property) ).ToList()); }
public IList <MethodInfo> FindActions(IList <MethodInfo> candidates, IClassStrategy classStrategy) { return(candidates.Where(methodInfo => methodInfo.GetCustomAttribute <NakedObjectsIgnoreAttribute>() == null && !methodInfo.IsStatic && !methodInfo.IsGenericMethod && classStrategy.IsTypeToBeIntrospected(methodInfo.ReturnType) && ParametersAreSupported(methodInfo, classStrategy)).ToList()); }
public bool Filters(MethodInfo method, IClassStrategy classStrategy) { string typeName = method.DeclaringType == null ? "Unknown" : method.DeclaringType.FullName; //todo rework this so that factories filter actions appropraitely if (classStrategy.IsSystemClass(method.DeclaringType)) { Log.InfoFormat("Skipping fields in {0} (system class according to ClassStrategy)", typeName); return(true); } if (method.GetCustomAttribute <NakedObjectsIgnoreAttribute>() != null) { Log.InfoFormat("Ignoring method: {0}.{1} because it is ignored", typeName, method.Name); return(true); } if (method.IsStatic) { Log.InfoFormat("Ignoring method: {0}.{1} because it is static", typeName, method.Name); return(true); } if (method.IsGenericMethod) { Log.InfoFormat("Ignoring method: {0}.{1} because it is generic", typeName, method.Name); return(true); } if (!classStrategy.IsTypeToBeIntrospected(method.ReturnType)) { Log.InfoFormat("Ignoring method: {0}.{1} because return type is of type {3}", typeName, method.Name, method.ReturnType); return(true); } foreach (ParameterInfo parameterInfo in method.GetParameters()) { if (!classStrategy.IsTypeToBeIntrospected(parameterInfo.ParameterType)) { Log.InfoFormat("Ignoring method: {0}.{1} because parameter '{2}' is of type {3}", typeName, method.Name, parameterInfo.Name, parameterInfo.ParameterType); return(true); } } return(false); }
public override IList <PropertyInfo> FindCollectionProperties(IList <PropertyInfo> candidates, IClassStrategy classStrategy) { IList <Type> collectionTypes = BuildCollectionTypes(candidates); return(candidates.Where(property => property.GetGetMethod() != null && property.GetCustomAttribute <NakedObjectsIgnoreAttribute>() == null && classStrategy.IsTypeToBeIntrospected(property.PropertyType) && collectionTypes.Contains(property.PropertyType)).ToList()); }
private bool ParametersAreSupported(MethodInfo method, IClassStrategy classStrategy) { foreach (ParameterInfo parameterInfo in method.GetParameters()) { if (!classStrategy.IsTypeToBeIntrospected(parameterInfo.ParameterType)) { Log.InfoFormat("Ignoring method: {0}.{1} because parameter '{2}' is of type {3}", method.DeclaringType, method.Name, parameterInfo.Name, parameterInfo.ParameterType); return(false); } } return(true); }
private bool ParametersAreSupported(MethodInfo method, IClassStrategy classStrategy) { foreach (ParameterInfo parameterInfo in method.GetParameters()) { if (!classStrategy.IsTypeToBeIntrospected(parameterInfo.ParameterType)) { // log if not a System or NOF type if (!TypeUtils.IsSystem(method.DeclaringType) && !TypeUtils.IsNakedObjects(method.DeclaringType)) { Log.WarnFormat("Ignoring method: {0}.{1} because parameter '{2}' is of type {3}", method.DeclaringType, method.Name, parameterInfo.Name, parameterInfo.ParameterType); } return(false); } } return(true); }
protected IList<PropertyInfo> PropertiesToBeIntrospected(IList<PropertyInfo> candidates, IClassStrategy classStrategy) { return candidates.Where(property => property.GetGetMethod() != null && classStrategy.IsTypeToBeIntrospected(property.PropertyType) && IsPropertyIncluded(property) ).ToList(); }
public IList<MethodInfo> FindActions(IList<MethodInfo> candidates, IClassStrategy classStrategy) { return candidates.Where(methodInfo => methodInfo.GetCustomAttribute<NakedObjectsIgnoreAttribute>() == null && !methodInfo.IsStatic && !methodInfo.IsGenericMethod && classStrategy.IsTypeToBeIntrospected(methodInfo.ReturnType) && ParametersAreSupported(methodInfo, classStrategy)).ToList(); }
private bool ParametersAreSupported(MethodInfo method, IClassStrategy classStrategy) { foreach (ParameterInfo parameterInfo in method.GetParameters()) { if (!classStrategy.IsTypeToBeIntrospected(parameterInfo.ParameterType)) { Log.InfoFormat("Ignoring method: {0}.{1} because parameter '{2}' is of type {3}", method.DeclaringType, method.Name, parameterInfo.Name, parameterInfo.ParameterType); return false; } } return true; }
private bool ParametersAreSupported(MethodInfo method, IClassStrategy classStrategy) { foreach (ParameterInfo parameterInfo in method.GetParameters()) { if (!classStrategy.IsTypeToBeIntrospected(parameterInfo.ParameterType)) { // log if not a System or NOF type if (!TypeUtils.IsSystem(method.DeclaringType) && !TypeUtils.IsNakedObjects(method.DeclaringType)) { Log.WarnFormat("Ignoring method: {0}.{1} because parameter '{2}' is of type {3}", method.DeclaringType, method.Name, parameterInfo.Name, parameterInfo.ParameterType); } return false; } } return true; }