Esempio n. 1
0
 public EmitSettings With(
     OptParam <string> @namespace = default,
     OptParam <ImmutableDictionary <string, string> > primitiveTypeMapping = default,
     OptParam <ImmutableDictionary <string, ValidatorConfig> > validators  = default,
     OptParam <IEnumerable <ExternalSymbolConfig> > externalSymbols        = default,
     OptParam <IEnumerable <string> > additionalReferences = default,
     OptParam <bool> emitInterfaceWithMethod   = default,
     OptParam <bool> emitOptionalWithMethod    = default,
     OptParam <bool> fallbackToStringType      = default,
     OptParam <bool> addJsonPropertyAttributes = default,
     OptParam <bool> emitPartialClasses        = default,
     OptParam <bool> emitValidationExtension   = default
     )
 {
     return(new EmitSettings(
                @namespace.ValueOrDefault(this.Namespace),
                primitiveTypeMapping.ValueOrDefault(this.PrimitiveTypeMapping),
                validators.ValueOrDefault(this.Validators),
                externalSymbols.ValueOrDefault(this.ExternalSymbols),
                additionalReferences.ValueOrDefault(this.AdditionalReferences),
                this.EmitWithMethods,
                emitInterfaceWithMethod.ValueOrDefault(this.EmitInterfaceWithMethods),
                emitOptionalWithMethod.ValueOrDefault(this.EmitOptionalWithMethods),
                this.WithMethodReturnValidationResult,
                fallbackToStringType.ValueOrDefault(this.FallbackToStringType),
                addJsonPropertyAttributes.ValueOrDefault(this.AddJsonPropertyAttributes),
                emitPartialClasses.ValueOrDefault(this.EmitPartialClasses),
                emitValidationExtension.ValueOrDefault(this.EmitValidationExtension)
                ));
 }
 public ValidationResult <MyType> With(OptParam <MyType> f1 = default(OptParam <MyType>), OptParam <string> f2 = default(OptParam <string>), OptParam <string> f3 = default(OptParam <string>), OptParam <MyType> f4 = default(OptParam <MyType>))
 {
     return(With(f1.ValueOrDefault(F1), f2.ValueOrDefault(F2), f3.ValueOrDefault(F3), f4.ValueOrDefault(F4)));
 }
Esempio n. 3
0
 public ValidationResult <User> With(OptParam <string> name = default(OptParam <string>), OptParam <Email> email = default(OptParam <Email>))
 {
     return(With(name.ValueOrDefault(Name), email.ValueOrDefault(Email)));
 }
 public ValidationResult <Composite123> With(OptParam <string> field543 = default(OptParam <string>), OptParam <int> abcSS = default(OptParam <int>))
 {
     return(With(field543.ValueOrDefault(Field543), abcSS.ValueOrDefault(AbcSS)));
 }
Esempio n. 5
0
 public ValidationResult <Test123> With(OptParam <ImmutableArray <string> > field543 = default(OptParam <ImmutableArray <string> >), OptParam <int> abcSS = default(OptParam <int>))
 {
     return(With(field543.ValueOrDefault(Field543), abcSS.ValueOrDefault(AbcSS)));
 }
Esempio n. 6
0
 public ValidationResult <T> With(OptParam <int> a = default(OptParam <int>), OptParam <ImmutableArray <string> > b = default(OptParam <ImmutableArray <string> >))
 {
     return(With(a.ValueOrDefault(A), b.ValueOrDefault(B)));
 }
 ValidationResult <Interface1> Interface1.With(OptParam <ImmutableArray <string> > field543 = default(OptParam <ImmutableArray <string> >), OptParam <ImmutableArray <int> > someName = default(OptParam <ImmutableArray <int> >))
 {
     return(With(field543.ValueOrDefault(Field543), someName.ValueOrDefault(SomeName), AbcSS).Cast <Interface1>());
 }
Esempio n. 8
0
        /// <summary> Declares a method that overrides the <paramref name="overriddenMethod" /> in the specified declaring type. The method must be virtual or from an interface. </summary>
        public static MethodSignature Override(TypeSignature declaringType, MethodSignature overriddenMethod, OptParam <bool> isVirtual = default, bool isAbstract = false)
        {
            var isInterface = overriddenMethod.DeclaringType.Kind == "interface";

            if (!isInterface && !overriddenMethod.IsVirtual)
            {
                throw new ArgumentException($"Can't override non-virtual method {overriddenMethod}");
            }

            overriddenMethod = overriddenMethod.Clone();
            var isVirtualP = isVirtual.ValueOrDefault(!isInterface && declaringType.CanOverride || isAbstract);

            return(overriddenMethod.With(declaringType, isVirtual: isVirtualP && declaringType.CanOverride, isOverride: !isInterface, isAbstract: isAbstract));
        }
 /// <summary> Sets the specified properties while cloning the A: comment for type A </summary>
 /// <param name="propA">comment for propA</param>
 /// <param name="propAX">comment for propAX</param>
 public ValidationResult <A> With(OptParam <string> propA = default(OptParam <string>), OptParam <string> propAX = default(OptParam <string>))
 {
     return(With(propA.ValueOrDefault(PropA), propAX.ValueOrDefault(PropAX)));
 }
 public ValidationResult <Composite123> With(OptParam <string> stringF = default(OptParam <string>), OptParam <string> nullableStringF = default(OptParam <string>), OptParam <int?> nullableIntF = default(OptParam <int?>), OptParam <int?> intF = default(OptParam <int?>), OptParam <double> floatF = default(OptParam <double>), OptParam <ImmutableArray <string>?> nullListF = default(OptParam <ImmutableArray <string>?>), OptParam <Composite123> thisF = default(OptParam <Composite123>))
 {
     return(With(stringF.ValueOrDefault(StringF), nullableStringF.ValueOrDefault(NullableStringF), nullableIntF.ValueOrDefault(NullableIntF), intF.ValueOrDefault(IntF), floatF.ValueOrDefault(FloatF), nullListF.ValueOrDefault(NullListF), thisF.ValueOrDefault(ThisF)));
 }
Esempio n. 11
0
 public ValidationResult <A> With(OptParam <string> h = default(OptParam <string>), OptParam <int> h2 = default(OptParam <int>))
 {
     return(With(h.ValueOrDefault(H), h2.ValueOrDefault(H2)));
 }
Esempio n. 12
0
        /// <summary> Declares a property that overrides the <paramref name="overriddenProperty" /> in the specified declaring type. The property must be virtual or from an interface. </summary>
        public static PropertySignature Override(TypeSignature declaringType, PropertySignature overriddenProperty, OptParam <bool> isVirtual = default, bool isAbstract = false)
        {
            var isInterface = overriddenProperty.DeclaringType.Kind == "interface";

            if (!isInterface && !overriddenProperty.IsVirtual)
            {
                throw new ArgumentException($"Can't override non-virtual property {overriddenProperty}");
            }

            return(Create(overriddenProperty.Name,
                          declaringType,
                          overriddenProperty.Type,
                          overriddenProperty.Getter?.Accessibility,
                          overriddenProperty.Setter?.Accessibility,
                          isVirtual: isVirtual.ValueOrDefault(!isInterface && declaringType.CanOverride),
                          isOverride: !isInterface,
                          isAbstract: isAbstract));
        }