private void ProcessArray(IReflector reflector, Type type, ISpecification holder) {
            FacetUtils.AddFacet(new ArrayFacet(holder));
            FacetUtils.AddFacet(new TypeOfFacetInferredFromArray(holder));

            var elementType = type.GetElementType();
            reflector.LoadSpecification(elementType);
        }
 public override void Process(IReflector reflector, MethodInfo method, IMethodRemover methodRemover, ISpecificationBuilder specification) {
     if ((method.ReturnType.IsPrimitive || TypeUtils.IsEnum(method.ReturnType)) && method.GetCustomAttribute<OptionallyAttribute>() != null) {
         Log.Warn("Ignoring Optionally annotation on primitive parameter on " + method.ReflectedType + "." + method.Name);
         return;
     }
     Process(method, specification);
 }
 public override void Process(IReflector reflector, PropertyInfo method, IMethodRemover methodRemover, ISpecificationBuilder specification) {
     if (method.PropertyType.IsAssignableFrom(typeof(ContactType))) {
         FacetUtils.AddFacet(new NotNavigableFacet(specification));
     }
     if (method.PropertyType.IsAssignableFrom(typeof(AddressType))) {
         FacetUtils.AddFacet(new NotNavigableFacet(specification));
     }
     if (method.PropertyType.IsAssignableFrom(typeof(ContactType))) {
         FacetUtils.AddFacet(new NotNavigableFacet(specification));
     }
     if (method.PropertyType.IsAssignableFrom(typeof(Culture))) {
         FacetUtils.AddFacet(new NotNavigableFacet(specification));
     }
     if (method.PropertyType.IsAssignableFrom(typeof(SalesReason))) {
         FacetUtils.AddFacet(new NotNavigableFacet(specification));
     }
     if (method.PropertyType.IsAssignableFrom(typeof(UnitMeasure))) {
         FacetUtils.AddFacet(new NotNavigableFacet(specification));
     }
     if (method.PropertyType.IsAssignableFrom(typeof(ScrapReason))) {
         FacetUtils.AddFacet(new NotNavigableFacet(specification));
     }
     if (method.PropertyType.IsAssignableFrom(typeof(ProductSubcategory))) {
         FacetUtils.AddFacet(new NotNavigableFacet(specification));
     }
     if (method.PropertyType.IsAssignableFrom(typeof(ProductCategory))) {
         FacetUtils.AddFacet(new NotNavigableFacet(specification));
     }
 }
 public override void ProcessParams(IReflector reflector, MethodInfo method, int paramNum, ISpecificationBuilder holder) {
     ParameterInfo parameter = method.GetParameters()[paramNum];
     if (TypeUtils.IsString(parameter.ParameterType)) {
         var attribute = parameter.GetCustomAttribute<MultiLineAttribute>();
         FacetUtils.AddFacet(Create(attribute, holder));
     }
 }
 public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder spec) {
     var attr = type.GetCustomAttribute<NakedObjectsTypeAttribute>();
     if (attr == null) {
         RemoveExplicitlyIgnoredMembers(type, methodRemover);
     } else {
         switch (attr.ReflectionScope) {
             case ReflectOver.All:
                 RemoveExplicitlyIgnoredMembers(type, methodRemover);
             break;
             case ReflectOver.TypeOnlyNoMembers:
                 foreach (MethodInfo method in type.GetMethods()) {
                     methodRemover.RemoveMethod(method);
                 }
                 break;
             case ReflectOver.ExplicitlyIncludedMembersOnly:
                 foreach (MethodInfo method in type.GetMethods()) {
                     if (method.GetCustomAttribute<NakedObjectsIncludeAttribute>() == null) {
                         methodRemover.RemoveMethod(method);
                     }
                 }
                 break;
             case ReflectOver.None:
                 throw new ReflectionException("Attempting to introspect a class that has been marked with NakedObjectsType with ReflectOver.None");
             default:
                 throw new ReflectionException(String.Format("Unhandled value for ReflectOver: {0}", attr.ReflectionScope));
         }
     }
 }
Example #6
0
 public virtual IReflectClass ClassReflector(IReflector reflector, ClassMetadata classMetadata
     , bool isPrimitive)
 {
     return isPrimitive
         ? Handlers4.PrimitiveClassReflector(classMetadata, reflector)
         : classMetadata.ClassReflector();
 }
        private void Process(IReflector reflector, MethodInfo member, ISpecification holder) {
            var allParams = member.GetParameters();
            var paramsWithAttribute = allParams.Where(p => p.GetCustomAttribute<ContributedActionAttribute>() != null).ToArray();
            if (!paramsWithAttribute.Any()) return; //Nothing to do
            var facet = new ContributedActionFacet(holder);
            foreach (ParameterInfo p in paramsWithAttribute) {
                var attribute = p.GetCustomAttribute<ContributedActionAttribute>();
                var type = reflector.LoadSpecification<IObjectSpecImmutable>(p.ParameterType);
                if (type != null) {
                    if (type.IsParseable) {
                        Log.WarnFormat("ContributedAction attribute added to a value parameter type: {0}", member.Name);
                    }
                    else if (type.IsCollection) {
                        var parent = reflector.LoadSpecification(member.DeclaringType);

                        if (parent is IObjectSpecBuilder) {
                            AddLocalCollectionContributedAction(reflector,  p, facet);
                        }
                        else {
                            AddCollectionContributedAction(reflector, member, type, p, facet, attribute);
                        }
                    }
                    else {
                        facet.AddObjectContributee(type, attribute.SubMenu, attribute.Id);
                    }
                }
            }
            FacetUtils.AddFacet(facet);
        }
Example #8
0
 public NetConstructor(IReflector reflector, ConstructorInfo
     constructor)
 {
     this.reflector = reflector;
     this.constructor = constructor;
     Platform4.SetAccessible(constructor);
 }
        public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
            IFacet facet = null;

            if (!type.IsInterface && typeof (IViewModel).IsAssignableFrom(type)) {
                MethodInfo deriveMethod = type.GetMethod("DeriveKeys", new Type[] {});
                MethodInfo populateMethod = type.GetMethod("PopulateUsingKeys", new[] {typeof (string[])});

                var toRemove = new List<MethodInfo> {deriveMethod, populateMethod};

                if (typeof (IViewModelEdit).IsAssignableFrom(type)) {
                    facet = new ViewModelEditFacetConvention(specification);
                }
                else if (typeof (IViewModelSwitchable).IsAssignableFrom(type)) {
                    MethodInfo isEditViewMethod = type.GetMethod("IsEditView");
                    toRemove.Add(isEditViewMethod);
                    facet = new ViewModelSwitchableFacetConvention(specification);
                }
                else {
                    facet = new ViewModelFacetConvention(specification);
                }
                methodRemover.RemoveMethods(toRemove.ToArray());
            }

            FacetUtils.AddFacet(facet);
        }
Example #10
0
 public EnigmaMachine(IAlphabet alphabet, IRotor leftRotor, IRotor centerRotor, IRotor righRotor, IReflector reflector)
 {
     _alphabet = alphabet;
     _leftRotor = leftRotor;
     _centerRotor = centerRotor;
     _rightRotor = righRotor;
     _reflector = reflector;
 }
 public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
     if (typeof (IEnumerable).IsAssignableFrom(type) && !TypeUtils.IsSystem(type)) {
         MethodInfo method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.GetEnumeratorMethod, null, Type.EmptyTypes);
         if (method != null) {
             methodRemover.RemoveMethod(method);
         }
     }
 }
Example #12
0
		public virtual IReflectClass ClassReflector(IReflector reflector)
		{
			if (_classReflector == null)
			{
				_classReflector = ((IBuiltinTypeHandler)GetHandler()).ClassReflector();
			}
			return _classReflector;
		}
 //---------------------------------------------------------------------
 //  Constructor
 //---------------------------------------------------------------------
 /**
  * Creates a new <code>CommandMap</code> object
  *
  * @param eventDispatcher The <code>IEventDispatcher</code> to listen to
  * @param injector An <code>IInjector</code> to use for this context
  * @param reflector An <code>IReflector</code> to use for this context
  */
 public CommandMap( IEventDispatcher eventDispatcher, IInjector injector, IReflector reflector )
 {
     this.eventDispatcher = eventDispatcher;
     this.injector = injector;
     this.reflector = reflector;
     this.eventTypeMap = new Dictionary<string,Dictionary<Type, Dictionary<Type, Action<Event>>>>();
     this.verifiedCommandClasses = new Dictionary<Type,bool>();
 }
 public override void Process(IReflector reflector, PropertyInfo property, IMethodRemover methodRemover, ISpecificationBuilder specification) {
     if (CollectionUtils.IsCollectionButNotArray(property.PropertyType)) {
         specification.AddFacet(new CollectionResetFacet(property, specification));
     }
     else {
         base.Process(reflector, property, methodRemover, specification);
     }
 }
 public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
     FacetUtils.AddFacets(
         new IFacet[] {
             new DescribedAsFacetNone(specification),
             new ImmutableFacetNever(specification),
             new TitleFacetNone(specification)
         });
 }
Example #16
0
 public virtual void RegisterReflector(IReflector reflector)
 {
     _classReflector = reflector.ForClass(JavaClass());
     var clazz = PrimitiveJavaClass();
     if (clazz != null)
     {
         _primitiveClassReflector = reflector.ForClass(clazz);
     }
 }
 public override void Process(IReflector reflector, PropertyInfo property, IMethodRemover methodRemover, ISpecificationBuilder specification) {
     if ((property.PropertyType.IsPrimitive || TypeUtils.IsEnum(property.PropertyType)) && property.GetCustomAttribute<OptionallyAttribute>() != null) {
         Log.Warn("Ignoring Optionally annotation on primitive or un-readable parameter on " + property.ReflectedType + "." + property.Name);
         return;
     }
     if (property.GetGetMethod() != null && !property.PropertyType.IsPrimitive) {
         Process(property, specification);
     }
 }
 public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
     if (IsDynamicProxyType(type)) {
         foreach (MethodInfo method in type.GetMethods().Join(MethodsToRemove, mi => mi.Name, s => s, (mi, s) => mi)) {
             if (methodRemover != null && method != null) {
                 methodRemover.RemoveMethod(method);
             }
         }
     }
 }
        public override void ProcessParams(IReflector reflector, MethodInfo method, int paramNum, ISpecificationBuilder holder) {
            ParameterInfo parameter = method.GetParameters()[paramNum];

            if (IsDatetimeOrNullableDateTime(parameter.ParameterType)) {
                var dataTypeAttribute = parameter.GetCustomAttribute<DataTypeAttribute>();
                var concurrencyCheckAttribute = parameter.GetCustomAttribute<ConcurrencyCheckAttribute>();
                FacetUtils.AddFacet(Create(dataTypeAttribute, concurrencyCheckAttribute, holder));
            }
        }
 public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
     Type currentType = type;
     while (currentType != null) {
         if (TypeUtils.IsSystem(currentType)) {
             ProcessSystemType(currentType, methodRemover, specification);
         }
         currentType = currentType.BaseType;
     }
 }
        public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
            if (typeof (Enum).IsAssignableFrom(type)) {
                Type semanticsProviderType = typeof (EnumValueSemanticsProvider<>).MakeGenericType(type);
                var spec = reflector.LoadSpecification<IObjectSpecImmutable>(type);
                object semanticsProvider = Activator.CreateInstance(semanticsProviderType, spec, specification);

                MethodInfo method = typeof (ValueUsingValueSemanticsProviderFacetFactory).GetMethod("AddValueFacets", BindingFlags.Static | BindingFlags.Public).MakeGenericMethod(type);
                method.Invoke(null, new[] {semanticsProvider, specification});
            }
        }
Example #22
0
		public SelfClass(IReflector parentReflector, SelfReflectionRegistry registry, Type
			 clazz)
		{
			// public SelfClass() {
			// super();
			// }
			_parentReflector = parentReflector;
			_registry = registry;
			_class = clazz;
		}
        public void RunBeforeEachTest()
        {
            eventDispatcher = new EventDispatcher();
            injector = new UnityInjector();
            reflector = new UnityReflector();
            commandMap = new CommandMap( eventDispatcher, injector, reflector );

            //TODO Use the Unity lifetimemanager here
            injector.MapValue( typeof(ICommandTest), this  );
        }
Example #24
0
		public static IReflectClass PrimitiveClassReflector(ITypeHandler4 handler, IReflector
			 reflector)
		{
			ITypeHandler4 baseTypeHandler = BaseTypeHandler(handler);
			if (baseTypeHandler is PrimitiveHandler)
			{
				return ((PrimitiveHandler)baseTypeHandler).PrimitiveClassReflector();
			}
			return null;
		}
        public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
            var facets = new List<IFacet> {
                new TypeIsAbstractFacet(specification, IsAbstract(type)),
                new TypeIsInterfaceFacet(specification, IsInterface(type)),
                new TypeIsSealedFacet(specification, IsSealed(type)),
                new TypeIsVoidFacet(specification, IsVoid(type))
            };

            FacetUtils.AddFacets(facets);
        }
 public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
     MethodInfo method = FindMethod(reflector, type, MethodType.Class, RecognisedMethodsAndPrefixes.MenuMethod, null, null);
     if (method != null) {
         RemoveMethod(methodRemover, method);
         FacetUtils.AddFacet(new MenuFacetViaMethod(method, specification));
     }
     else {
         FacetUtils.AddFacet(new MenuFacetDefault(specification));
     }
 }
Example #27
0
        public ForEachTagParser(IReflector reflector, IFilterRunner filterRunner)
        {
            if (reflector == null)
                throw new ArgumentNullException("reflector");
            this.reflector = reflector;

            if (filterRunner == null)
                throw new ArgumentNullException("filterRunner");
            this.filterRunner = filterRunner;
        }
		public override IReflectClass ClassReflector(IReflector reflector, ClassMetadata 
			classMetadata, bool isPrimitive)
		{
			IReflectClass primitiveClaxx = Handlers4.PrimitiveClassReflector(classMetadata, reflector
				);
			if (primitiveClaxx != null)
			{
				return primitiveClaxx;
			}
			return base.ClassReflector(reflector, classMetadata, isPrimitive);
		}
 public override void ProcessParams(IReflector reflector, MethodInfo method, int paramNum, ISpecificationBuilder holder) {
     ParameterInfo parameter = method.GetParameters()[paramNum];
     if (parameter.ParameterType.IsPrimitive || TypeUtils.IsEnum(parameter.ParameterType)) {
         if (method.GetCustomAttribute<OptionallyAttribute>() != null) {
             Log.Warn("Ignoring Optionally annotation on primitive parameter " + paramNum + " on " + method.ReflectedType + "." + method.Name);
         }
         return;
     }
     var attribute = parameter.GetCustomAttribute<OptionallyAttribute>();
     FacetUtils.AddFacet(Create(attribute, holder));
 }
        public RuntimeServer(	IReader reader
							, IBaseMarshaller marshaller
							, IReferenceManager referenceManager
							, IReflector reflector
						)
        {
            this.reader				= reader;
            this.marshaller			= marshaller;
            this.referenceManager	= referenceManager;
            this.reflector			= reflector;
        }
Example #31
0
 public virtual void SetParent(IReflector reflector)
 {
     _parent = reflector;
 }
Example #32
0
 public DrsTestSuiteBuilder(IDrsProviderFixture a, IDrsProviderFixture b, Type[] classes
                            , IReflector reflector) : base(AppendDestructor(classes))
 {
     _fixtures = new DrsFixture(a, b, reflector);
 }
Example #33
0
 public IImmutableDictionary <string, ITypeSpecBuilder> ProcessParams(IReflector reflector, MethodInfo method, int paramNum, ISpecificationBuilder holder, IImmutableDictionary <string, ITypeSpecBuilder> metamodel) => metamodel;
Example #34
0
 public override IImmutableDictionary <string, ITypeSpecBuilder> Process(IReflector reflector, MethodInfo method, ISpecificationBuilder specification, IImmutableDictionary <string, ITypeSpecBuilder> metamodel)
 {
     FacetUtils.AddFacet(Create(specification));
     return(metamodel);
 }
Example #35
0
 public ImmutableDictionary <string, ITypeSpecBuilder> ProcessParams(IReflector reflector, MethodInfo method, int paramNum, ISpecificationBuilder specification, ImmutableDictionary <string, ITypeSpecBuilder> metamodel)
 {
     throw new NotImplementedException();
 }
Example #36
0
 protected SmartInvoker(object instance, IReflectPolicy policy)
 {
     instance.ThrowIfNullArgument(nameof(instance));
     _r = Reflector.Bind(instance, policy);
 }
        public override IImmutableDictionary <string, ITypeSpecBuilder> ProcessParams(IReflector reflector, MethodInfo method, int paramNum, ISpecificationBuilder holder, IImmutableDictionary <string, ITypeSpecBuilder> metamodel)
        {
            var facets = new List <IFacet>();

            if (holder is IActionParameterSpecImmutable param)
            {
                var         name       = method.GetParameters()[paramNum].Name ?? method.GetParameters()[paramNum].ParameterType.FullName;
                INamedFacet namedFacet = new NamedFacetInferred(name, holder);
                facets.Add(namedFacet);
                facets.Add(new DescribedAsFacetNone(holder));
                facets.Add(new MultiLineFacetNone(holder));
                facets.Add(new MaxLengthFacetZero(holder));
                facets.Add(new TypicalLengthFacetZero(holder));
                DefaultTypicalLength(facets, param.Specification, param);
            }

            FacetUtils.AddFacets(facets);
            return(metamodel);
        }
 public override void Process(IReflector reflector, PropertyInfo property, IMethodRemover methodRemover, ISpecificationBuilder specification)
 {
     FacetUtils.AddFacet(Create(specification));
 }
Example #39
0
 public override IImmutableDictionary <string, ITypeSpecBuilder> ProcessParams(IReflector reflector, MethodInfo method, int paramNum, ISpecificationBuilder holder, IImmutableDictionary <string, ITypeSpecBuilder> metamodel)
 {
     FacetUtils.AddFacet(Create(holder));
     return(metamodel);
 }
 public override void Process(IReflector reflector, MethodInfo method, IMethodRemover methodRemover, ISpecificationBuilder specification) => FacetUtils.AddFacet(Create(specification));
 public override IImmutableDictionary <string, ITypeSpecBuilder> Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification, IImmutableDictionary <string, ITypeSpecBuilder> metamodel)
 {
     return(metamodel);
 }
Example #42
0
 public GenericReflector(IReflector delegateReflector) : this(null, delegateReflector
                                                              )
 {
 }
Example #43
0
        public DiContainer(IReflector reflector)
        {
            Requires.NotNull(reflector, nameof(reflector));

            this.reflector = reflector;
        }
Example #44
0
        public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification)
        {
            var attribute = type.GetCustomAttribute <ProgramPersistableOnlyAttribute>();

            FacetUtils.AddFacet(Create(attribute, specification));
        }
 public override IImmutableDictionary <string, ITypeSpecBuilder> Process(IReflector reflector, PropertyInfo property, ISpecificationBuilder specification, IImmutableDictionary <string, ITypeSpecBuilder> metamodel)
 {
     Process(specification);
     return(metamodel);
 }
 public override void ProcessParams(IReflector reflector, MethodInfo method, int paramNum, ISpecificationBuilder holder)
 {
     FacetUtils.AddFacet(Create(holder));
 }
Example #47
0
 public virtual void ProcessParams(IReflector reflector, MethodInfo method, int paramNum, ISpecificationBuilder holder)
 {
 }
 public override void Process(IReflector reflector, MethodInfo method, IMethodRemover methodRemover, ISpecificationBuilder specification)
 {
     Process(specification);
 }
Example #49
0
 public ImmutableDictionary <string, ITypeSpecBuilder> Process(IReflector reflector, PropertyInfo property, IMethodRemover methodRemover, ISpecificationBuilder specification, FeatureType featureType, ImmutableDictionary <string, ITypeSpecBuilder> metamodel)
 {
     throw new NotImplementedException();
 }
        public override void Process(IReflector reflector, PropertyInfo property, IMethodRemover methodRemover, ISpecificationBuilder specification)
        {
            var attribute = property.GetCustomAttribute <NotNavigableAttribute>() ?? property.PropertyType.GetCustomAttribute <NotNavigableAttribute>();

            FacetUtils.AddFacet(Create(attribute, specification));
        }
        public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification)
        {
            Attribute attribute = type.GetCustomAttribute <RegularExpressionAttribute>() ?? (Attribute)type.GetCustomAttribute <RegExAttribute>();

            FacetUtils.AddFacet(Create(attribute, specification));
        }
Example #52
0
 public virtual void Process(IReflector reflector, PropertyInfo property, IMethodRemover methodRemover, ISpecificationBuilder specification)
 {
 }
 public override void Process(IReflector reflector, PropertyInfo property, IMethodRemover methodRemover, ISpecificationBuilder specification)
 {
     Process(specification);
 }
Example #54
0
 public IImmutableDictionary <string, ITypeSpecBuilder> Process(IReflector reflector, PropertyInfo property, IMethodRemover methodRemover, ISpecificationBuilder specification, IImmutableDictionary <string, ITypeSpecBuilder> metamodel) => metamodel;
Example #55
0
 public ReflectorToInstanceSerializerAdapater(IReflector reflector, Constructor constructor)
 {
     this.reflector   = reflector;
     this.constructor = constructor;
 }
Example #56
0
        public override IImmutableDictionary <string, ITypeSpecBuilder> ProcessParams(IReflector reflector, MethodInfo method, int paramNum, ISpecificationBuilder holder, IImmutableDictionary <string, ITypeSpecBuilder> metamodel)
        {
            ParameterInfo parameter         = method.GetParameters()[paramNum];
            var           dataTypeAttribute = parameter.GetCustomAttribute <DataTypeAttribute>();

            FacetUtils.AddFacet(Create(dataTypeAttribute, holder));
            return(metamodel);
        }
Example #57
0
 public DrsTestSuiteBuilder(IDrsProviderFixture a, IDrsProviderFixture b, Type clazz
                            , IReflector reflector) : this(a, b, new Type[] { clazz }, reflector)
 {
 }
Example #58
0
 public virtual void Process(IReflector reflector, MethodInfo method, IMethodRemover methodRemover, ISpecificationBuilder specification)
 {
 }
Example #59
0
 /// <param name="reflector"></param>
 internal SelfArray(IReflector reflector, SelfReflectionRegistry registry)
 {
     _registry = registry;
 }
Example #60
0
        public override void Process(IReflector reflector, Type type, IMethodRemover remover, ISpecificationBuilder specification)
        {
            var facets  = new List <IFacet>();
            var methods = new List <MethodInfo>();

            var method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.CreatedMethod, typeof(void), Type.EmptyTypes);

            if (method != null)
            {
                methods.Add(method);
                facets.Add(new CreatedCallbackFacetViaMethod(method, specification));
            }
            else
            {
                facets.Add(new CreatedCallbackFacetNull(specification));
            }

            method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.PersistingMethod, typeof(void), Type.EmptyTypes);

            if (method != null)
            {
                methods.Add(method);
                facets.Add(new PersistingCallbackFacetViaMethod(method, specification));
            }
            else
            {
                facets.Add(new PersistingCallbackFacetNull(specification));
            }

            method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.PersistedMethod, typeof(void), Type.EmptyTypes);

            if (method != null)
            {
                methods.Add(method);
                facets.Add(new PersistedCallbackFacetViaMethod(method, specification));
            }
            else
            {
                facets.Add(new PersistedCallbackFacetNull(specification));
            }

            method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.UpdatingMethod, typeof(void), Type.EmptyTypes);
            if (method != null)
            {
                methods.Add(method);
                facets.Add(new UpdatingCallbackFacetViaMethod(method, specification));
            }
            else
            {
                facets.Add(new UpdatingCallbackFacetNull(specification));
            }

            method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.UpdatedMethod, typeof(void), Type.EmptyTypes);
            if (method != null)
            {
                methods.Add(method);
                facets.Add(new UpdatedCallbackFacetViaMethod(method, specification));
            }
            else
            {
                facets.Add(new UpdatedCallbackFacetNull(specification));
            }

            method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.LoadingMethod, typeof(void), Type.EmptyTypes);
            if (method != null)
            {
                methods.Add(method);
                facets.Add(new LoadingCallbackFacetViaMethod(method, specification));
            }
            else
            {
                facets.Add(new LoadingCallbackFacetNull(specification));
            }

            method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.LoadedMethod, typeof(void), Type.EmptyTypes);
            if (method != null)
            {
                methods.Add(method);
                facets.Add(new LoadedCallbackFacetViaMethod(method, specification));
            }
            else
            {
                facets.Add(new LoadedCallbackFacetNull(specification));
            }

            method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.DeletingMethod, typeof(void), Type.EmptyTypes);
            if (method != null)
            {
                methods.Add(method);
                facets.Add(new DeletingCallbackFacetViaMethod(method, specification));
            }
            else
            {
                facets.Add(new DeletingCallbackFacetNull(specification));
            }

            method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.DeletedMethod, typeof(void), Type.EmptyTypes);
            if (method != null)
            {
                methods.Add(method);
                facets.Add(new DeletedCallbackFacetViaMethod(method, specification));
            }
            else
            {
                facets.Add(new DeletedCallbackFacetNull(specification));
            }

            method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.OnUpdatingErrorMethod, typeof(string), new[] { typeof(Exception) });
            if (method != null)
            {
                methods.Add(method);
                facets.Add(new OnUpdatingErrorCallbackFacetViaMethod(method, specification, Logger <OnUpdatingErrorCallbackFacetViaMethod>()));
            }
            else
            {
                facets.Add(new OnUpdatingErrorCallbackFacetNull(specification));
            }

            method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.OnPersistingErrorMethod, typeof(string), new[] { typeof(Exception) });
            if (method != null)
            {
                methods.Add(method);
                facets.Add(new OnPersistingErrorCallbackFacetViaMethod(method, specification, Logger <OnPersistingErrorCallbackFacetViaMethod>()));
            }
            else
            {
                facets.Add(new OnPersistingErrorCallbackFacetNull(specification));
            }

            remover.RemoveMethods(methods);
            FacetUtils.AddFacets(facets);
        }