public VerifiableObjectContract(ICustomVerifiableObjectContractImpl contractImpl) { _verifiableObjectContractImpl = contractImpl ?? throw new ArgumentNullException(nameof(contractImpl)); Type = contractImpl.Type; ObjectKind = contractImpl.ObjectKind; IsBasicType = contractImpl.IsBasicType; _memberContracts = contractImpl.GetMemberContractMap(); _valueKeys = _memberContracts.Keys.ToArray(); _reflectorProvider = null; _attributes = Arrays.Empty <Attribute>(); IncludeAnnotationsForType = false; }
public VerifiableObjectContract( Type type, Dictionary <string, VerifiableMemberContract> memberContracts) { _verifiableObjectContractImpl = null; Type = type ?? throw new ArgumentNullException(nameof(type)); ObjectKind = type.GetObjectKind(); IsBasicType = ObjectKind == VerifiableObjectKind.BasicType; _memberContracts = memberContracts ?? throw new ArgumentNullException(nameof(memberContracts)); _valueKeys = _memberContracts.Keys.ToArray(); _reflectorProvider = Type.GetReflector(); _attributes = _reflectorProvider.GetCustomAttributes(); IncludeAnnotationsForType = HasValidationAnnotationDefined(_attributes); }