Struct ContextResponse
- Namespace
- DirectoryToObject
- Assembly
- DirectoryToObject.dll
Response returned after processing a directory entry. This represents the fact that successful processing results in one of two cases: a JsonNode to be merged into the overall result or a IFileSystemDirectory instance into which the loader should recurse.
public readonly struct ContextResponse
- Inherited Members
Constructors
ContextResponse(Func<JsonNode?, JsonNode?>?, ContextResponse)
A new context response that is identical to another response, but with the node transformer function replaced.
public ContextResponse(Func<JsonNode?, JsonNode?>? nodeTransformer, ContextResponse otherResponse)
Parameters
nodeTransformerFunc<JsonNode, JsonNode>The new node transformation function.
otherResponseContextResponseThe other context response to copy.
ContextResponse(string, ContextResponse)
A new context response that is identical to another response, but with the property name replaced.
public ContextResponse(string propertyName, ContextResponse otherResponse)
Parameters
propertyNamestringThe new property name to use.
otherResponseContextResponseThe other context response to copy.
ContextResponse(string, IFileSystemDirectory, IDirectoryLoaderContextHandler?, Func<JsonNode?, JsonNode?>?)
A new response containing a IFileSystemDirectory into which the directory loader should recurse, optionally with a new DirectoryToObject.Internals.DefaultDirectoryLoaderContextHandler to use.
public ContextResponse(string propertyName, IFileSystemDirectory directory, IDirectoryLoaderContextHandler? childContext, Func<JsonNode?, JsonNode?>? nodeTransformer = null)
Parameters
propertyNamestringThe name in the parent JsonObject into which the directory should be loaded.
directoryIFileSystemDirectoryThe directory to recurse into.
childContextIDirectoryLoaderContextHandlerThe optional new DirectoryToObject.Internals.DefaultDirectoryLoaderContextHandler to use when loading the directory.
nodeTransformerFunc<JsonNode, JsonNode>An optional node transformation function.
ContextResponse(string, JsonNode?, Func<JsonNode?, JsonNode?>?)
A new response containing a JsonNode that will be set or merged into the PropertyName property of the parent JSON object.
public ContextResponse(string propertyName, JsonNode? node, Func<JsonNode?, JsonNode?>? nodeTransformer = null)
Parameters
propertyNamestringThe name in the parent JsonObject into which the node should be set or merged.
nodeJsonNodeThe JsonNode to set or merge.
nodeTransformerFunc<JsonNode, JsonNode>An optional node transformation function.
Fields
ChildContext
An optional context to use when recursing into a directory response.
public readonly IDirectoryLoaderContextHandler? ChildContext
Field Value
NodeTransformer
An optional node transformation function to apply to this node or directory.
public readonly Func<JsonNode?, JsonNode?>? NodeTransformer
Field Value
PropertyName
The name of the property in the parent JsonObject into which the response should be loaded.
public readonly string PropertyName
Field Value
Properties
Directory
The directory to recurse into.
public IFileSystemDirectory? Directory { get; }
Property Value
IsDirectory
Is true if this is a directory response.
[MemberNotNullWhen(true, "Directory")]
[MemberNotNullWhen(false, "Node")]
public bool IsDirectory { get; }
Property Value
IsNode
Is true if this is a node response.
[MemberNotNullWhen(true, "Node")]
[MemberNotNullWhen(false, "Directory")]
public bool IsNode { get; }
Property Value
Remarks
The Node property can still be null when this is true because the convention used by
System.Text.Json.Nodes to represent null JSON values is a .NET null reference.
Node
The JSON node in the response.
May be null if this is a directory response or a null JSON value.
public JsonNode? Node { get; }