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
TEndpointThe type of IEndpoint to generate code for.
- Inheritance
-
objectBuilderBase<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
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
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
keystringendpointIEndpointgeneratorIEndpointGenerator
Returns
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
keystringendpointTEndpointgeneratorIEndpointGenerator
Returns
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
endpointTEndpointextraArgumentsList<JvmExpression>generatorIEndpointGenerator
Returns
ExtraArguments(TEndpoint, IEndpointGenerator)
Returns the constructor arguments beyond the referrer and the relative URI.
protected virtual IEnumerable<JvmExpression> ExtraArguments(TEndpoint endpoint, IEndpointGenerator generator)
Parameters
endpointTEndpointgeneratorIEndpointGenerator
Returns
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
keystringendpointTEndpointgeneratorIEndpointGenerator
Returns
GetBaseType(TEndpoint, IEndpointGenerator)
Returns the TypedRest implementation class the endpoint derives from.
protected abstract JvmIdentifier GetBaseType(TEndpoint endpoint, IEndpointGenerator generator)
Parameters
endpointTEndpointgeneratorIEndpointGenerator
Returns
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
endpointTEndpoint