Table of Contents

Class BuilderBase<TEndpoint>

Namespace
TypedRest.CodeGeneration.Jvm.Endpoints
Assembly
TypedRest.CodeGeneration.Jvm.dll

Common base class for IBuilder<TEndpoint>s.

public abstract class BuilderBase<TEndpoint> : IBuilder<TEndpoint>, IBuilder where TEndpoint : IEndpoint

Type Parameters

TEndpoint

The type of IEndpoint to generate code for.

Inheritance
object
BuilderBase<TEndpoint>
Implements
IBuilder<TEndpoint>
Derived

Properties

RequiresGeneratedClass

Indicates whether this kind of endpoint needs a generated class even when it has no children.

protected virtual bool RequiresGeneratedClass { get; }

Property Value

bool

Remarks

Most kinds map to a concrete TypedRest class, which is simply constructed inline where there are no children to hold. Override this where the base type cannot be instantiated.

RequiresUriObject

Indicates whether the base type takes the relative URI as a URI rather than a String.

protected virtual bool RequiresUriObject { get; }

Property Value

bool

Remarks

Every Impl class has a secondary constructor taking a String. Override this where the base type has only the URI one, so that the literal gets wrapped.

Methods

Build(string, IEndpoint, IEndpointGenerator)

Builds the member exposing endpoint on its parent, plus any types needed for it.

public (JvmChildEndpoint child, IEnumerable<IJvmType> types) Build(string key, IEndpoint endpoint, IEndpointGenerator generator)

Parameters

key string
endpoint IEndpoint
generator IEndpointGenerator

Returns

(JvmChildEndpoint child, IEnumerable<IJvmType> types)

Build(string, TEndpoint, IEndpointGenerator)

Builds the member exposing endpoint on its parent, plus any types needed for it.

public (JvmChildEndpoint child, IEnumerable<IJvmType> types) Build(string key, TEndpoint endpoint, IEndpointGenerator generator)

Parameters

key string
endpoint TEndpoint
generator IEndpointGenerator

Returns

(JvmChildEndpoint child, IEnumerable<IJvmType> types)

BuildConstructor(TEndpoint, List<JvmExpression>, IEndpointGenerator)

Builds the constructor of a generated endpoint class.

protected virtual JvmConstructor BuildConstructor(TEndpoint endpoint, List<JvmExpression> extraArguments, IEndpointGenerator generator)

Parameters

endpoint TEndpoint
extraArguments List<JvmExpression>
generator IEndpointGenerator

Returns

JvmConstructor

ExtraArguments(TEndpoint, IEndpointGenerator)

Returns the constructor arguments beyond the referrer and the relative URI.

protected virtual IEnumerable<JvmExpression> ExtraArguments(TEndpoint endpoint, IEndpointGenerator generator)

Parameters

endpoint TEndpoint
generator IEndpointGenerator

Returns

IEnumerable<JvmExpression>

Remarks

Most JVM endpoints take a Class<T> for the entity they deserialize.

GetBase(string, TEndpoint, IEndpointGenerator)

Returns the TypedRest type the endpoint derives from, any additional types generated along the way, and any constructor arguments beyond the referrer and the relative URI.

protected virtual (JvmIdentifier baseType, IEnumerable<IJvmType> types, IEnumerable<JvmExpression> extraArguments) GetBase(string key, TEndpoint endpoint, IEndpointGenerator generator)

Parameters

key string
endpoint TEndpoint
generator IEndpointGenerator

Returns

(JvmIdentifier baseType, IEnumerable<IJvmType> types, IEnumerable<JvmExpression> extraArguments)

GetBaseType(TEndpoint, IEndpointGenerator)

Returns the TypedRest implementation class the endpoint derives from.

protected abstract JvmIdentifier GetBaseType(TEndpoint endpoint, IEndpointGenerator generator)

Parameters

endpoint TEndpoint
generator IEndpointGenerator

Returns

JvmIdentifier

RelativeUri(TEndpoint)

The relative URI of the endpoint, either as a literal or as the constructor parameter it is handed in.

protected JvmExpression RelativeUri(TEndpoint endpoint)

Parameters

endpoint TEndpoint

Returns

JvmExpression