Beispiel #1
0
        public IDecoderDescriptor <TField> HasField <TField>(string name, Func <TField> constructor,
                                                             Setter <TEntity, TField> setter)
        {
            var fieldDefinition = this.definition.Create <TField>();
            var fieldDescriptor = new TreeDecoderDescriptor <TState, TNative, TKey, TField>(this.converter, fieldDefinition);

            return(TreeDecoderDescriptor <TState, TNative, TKey, TEntity> .BindField(this.definition, name, constructor,
                                                                                     setter, fieldDescriptor));
        }
Beispiel #2
0
        public IDecoderDescriptor <TField> HasField <TField>(string name, Func <TField> constructor,
                                                             Setter <TEntity, TField> setter, IDecoderDescriptor <TField> descriptor)
        {
            if (!(descriptor is TreeDecoderDescriptor <TState, TNative, TKey, TField> ancestor))
            {
                throw new ArgumentOutOfRangeException(nameof(descriptor), "incompatible descriptor type");
            }

            return(TreeDecoderDescriptor <TState, TNative, TKey, TEntity> .BindField(this.definition, name, constructor,
                                                                                     setter, ancestor));
        }