Exemplo n.º 1
0
        private CSharpInterface GenerateEndpointInterface(IEndpoint endpoint, TypeList typeList, CSharpClass endpointImplementation)
        {
            var builder = _builders[endpoint.GetType()];

            var endpointInterface = new CSharpInterface(endpointImplementation.Identifier.ToInterface())
            {
                Interfaces  = { builder.GetInterface(endpoint, typeList) },
                Description = endpoint.Description
            };

            endpointInterface.Properties.AddRange(endpointImplementation.Properties);

            endpointImplementation.Interfaces.Add(endpointInterface.Identifier);

            typeList.Add(endpoint, endpointInterface);
            return(endpointInterface);
        }
Exemplo n.º 2
0
 private IEnumerable <CSharpProperty> GenerateEndpoints(EndpointList endpoints, TypeList typeList)
 => endpoints.Select(x => GenerateEndpoint(x.Key, x.Value, typeList));
Exemplo n.º 3
0
 private static CSharpClass GenerateSchema(CSharpIdentifier identifier, TypeList typeList)
 {
     // TODO: Proper implementation
     return(new CSharpClass(identifier));
 }
Exemplo n.º 4
0
        private CSharpClass GenerateEndpointImplementation(string key, IEndpoint endpoint, TypeList typeList, IList <CSharpProperty> children)
        {
            var builder = _builders[endpoint.GetType()];

            var endpointImplementation = new CSharpClass(_naming.EndpointType(key, endpoint))
            {
                BaseClass   = builder.GetConstruction(endpoint, typeList),
                Description = endpoint.Description
            };

            endpointImplementation.Properties.AddRange(children);

            typeList.Add(endpoint, endpointImplementation);
            return(endpointImplementation);
        }
Exemplo n.º 5
0
        private CSharpProperty GenerateEndpointWithChildren(string key, IEndpoint endpoint, TypeList typeList, IList <CSharpProperty> children)
        {
            var endpointImplementation = GenerateEndpointImplementation(key, endpoint, typeList, children);

            var identifier = GenerateInterfaces
                ? GenerateEndpointInterface(endpoint, typeList, endpointImplementation).Identifier
                : endpointImplementation.Identifier;

            return(new CSharpProperty(identifier, key)
            {
                GetterExpression = endpointImplementation.GetConstruction(),
                Description = endpoint.Description
            });
        }
Exemplo n.º 6
0
        private CSharpProperty GenerateEndpointWithoutChildren(string key, IEndpoint endpoint, TypeList typeList)
        {
            var builder = _builders[endpoint.GetType()];

            return(new CSharpProperty(builder.GetInterface(endpoint, typeList), _naming.Property(key))
            {
                GetterExpression = builder.GetConstruction(endpoint, typeList),
                Description = endpoint.Description
            });
        }