/// <inheritdoc/> public void AddPossibleType(IObjectGraphType type) { if (type == null) { throw new ArgumentNullException(nameof(type)); } this.IsValidInterfaceFor(type, throwError: true); PossibleTypes.Add(type); }
public IEnumerable <ICodeDescriptor> GetChildren() { yield return(ResultDescriptor); ; foreach (IClassDescriptor possibleType in PossibleTypes.Select(t => t.ResultDescriptor)) { yield return(possibleType); } }
public UnionType(string name, IEnumerable <ObjectType> possibleTypes, string description = null, IEnumerable <DirectiveInstance> directives = null) : base(name, description, directives) { foreach (var possibleType in possibleTypes) { if (PossibleTypes.ContainsKey(possibleType.Name)) { throw new InvalidOperationException( $"Type {Name} already has possibleType with name {possibleType.Name}"); } PossibleTypes[possibleType.Name] = possibleType; } }
/// <summary> /// Constructor used by specializations /// </summary> /// <param name="type">Type of request that being created</param> protected Request(PossibleTypes type) { RequestType = type; }
/// <inheritdoc/> public void AddPossibleType(IObjectGraphType type) { PossibleTypes.Add(type); }
/// <summary> /// Constructor used by all specializations, which in turn are used by /// senders of a message /// </summary> /// <param name="type">Type of request that being created</param> /// <param name="status">Status of the ack/nak</status> /// <param name="note">error message or note</note> protected Reply(PossibleTypes type, PossibleStatus status, string note) { ReplyType = type; Status = status; Note = note; }
/// <summary> /// Determines whether this instance can handle the specified type. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> public bool CanHandleType(Type type) { type = GetNotNullableType(type); return(PossibleTypes.Any(x => x.Type == type)); }