Search in sources :

Example 1 with V10RamlToPojoGType

use of org.raml.jaxrs.generator.v10.types.V10RamlToPojoGType in project raml-for-jax-rs by mulesoft-labs.

the class CurrentBuild method fetchType.

public V10GType fetchType(String name, TypeDeclaration typeDeclaration) {
    TypeName typeName = fetchRamlToPojoBuilder().fetchType(name, typeDeclaration);
    V10RamlToPojoGType type = new V10RamlToPojoGType(typeDeclaration);
    type.setJavaType(typeName);
    return type;
}
Also used : TypeName(com.squareup.javapoet.TypeName) V10RamlToPojoGType(org.raml.jaxrs.generator.v10.types.V10RamlToPojoGType)

Example 2 with V10RamlToPojoGType

use of org.raml.jaxrs.generator.v10.types.V10RamlToPojoGType in project raml-for-jax-rs by mulesoft-labs.

the class CurrentBuild method fetchType.

public V10GType fetchType(Resource resource, Method method, Response response, TypeDeclaration typeDeclaration) {
    if (typeDeclaration instanceof JSONTypeDeclaration) {
        return (V10GType) ((JsonSchemaTypeGenerator) builtTypes.get(typeDeclaration.type())).getType();
    }
    if (typeDeclaration instanceof XMLTypeDeclaration) {
        return (V10GType) ((XmlSchemaTypeGenerator) builtTypes.get(typeDeclaration.type())).getType();
    }
    RamlToPojo ramlToPojo = fetchRamlToPojoBuilder();
    if (ramlToPojo.isInline(typeDeclaration)) {
        TypeName typeName = fetchRamlToPojoBuilder().fetchType(Names.javaTypeName(resource, method, response, typeDeclaration), typeDeclaration);
        V10RamlToPojoGType type = new V10RamlToPojoGType(Names.javaTypeName(resource, method, response, typeDeclaration), typeDeclaration);
        type.setJavaType(typeName);
        return type;
    } else {
        TypeName typeName = fetchRamlToPojoBuilder().fetchType(typeDeclaration.type(), typeDeclaration);
        V10RamlToPojoGType type = new V10RamlToPojoGType(typeDeclaration.type(), typeDeclaration);
        type.setJavaType(typeName);
        return type;
    }
}
Also used : XMLTypeDeclaration(org.raml.v2.api.model.v10.datamodel.XMLTypeDeclaration) TypeName(com.squareup.javapoet.TypeName) V10RamlToPojoGType(org.raml.jaxrs.generator.v10.types.V10RamlToPojoGType) JSONTypeDeclaration(org.raml.v2.api.model.v10.datamodel.JSONTypeDeclaration)

Example 3 with V10RamlToPojoGType

use of org.raml.jaxrs.generator.v10.types.V10RamlToPojoGType in project raml-for-jax-rs by mulesoft-labs.

the class CurrentBuild method fetchType.

public V10GType fetchType(Resource resource, TypeDeclaration input) {
    RamlToPojo ramlToPojo = fetchRamlToPojoBuilder();
    if (ramlToPojo.isInline(input)) {
        TypeName typeName = fetchRamlToPojoBuilder().fetchType(Names.javaTypeName(resource, input), input);
        V10RamlToPojoGType type = new V10RamlToPojoGType(input);
        type.setJavaType(typeName);
        return type;
    } else {
        TypeName typeName = fetchRamlToPojoBuilder().fetchType(input.type(), input);
        V10RamlToPojoGType type = new V10RamlToPojoGType(input);
        type.setJavaType(typeName);
        return type;
    }
}
Also used : TypeName(com.squareup.javapoet.TypeName) V10RamlToPojoGType(org.raml.jaxrs.generator.v10.types.V10RamlToPojoGType)

Example 4 with V10RamlToPojoGType

use of org.raml.jaxrs.generator.v10.types.V10RamlToPojoGType in project raml-for-jax-rs by mulesoft-labs.

the class CurrentBuild method fetchType.

public V10GType fetchType(Resource implementation, Method method, TypeDeclaration typeDeclaration) {
    if (typeDeclaration instanceof JSONTypeDeclaration) {
        return (V10GType) ((JsonSchemaTypeGenerator) builtTypes.get(typeDeclaration.type())).getType();
    }
    if (typeDeclaration instanceof XMLTypeDeclaration) {
        return (V10GType) ((XmlSchemaTypeGenerator) builtTypes.get(typeDeclaration.type())).getType();
    }
    RamlToPojo ramlToPojo = fetchRamlToPojoBuilder();
    if (ramlToPojo.isInline(typeDeclaration)) {
        TypeName typeName = ramlToPojo.fetchType(Names.javaTypeName(implementation, method, typeDeclaration), typeDeclaration);
        V10RamlToPojoGType type = new V10RamlToPojoGType(Names.javaTypeName(implementation, method, typeDeclaration), typeDeclaration);
        type.setJavaType(typeName);
        return type;
    } else {
        TypeName typeName = ramlToPojo.fetchType(typeDeclaration.type(), typeDeclaration);
        V10RamlToPojoGType type = new V10RamlToPojoGType(typeDeclaration.type(), typeDeclaration);
        type.setJavaType(typeName);
        return type;
    }
}
Also used : XMLTypeDeclaration(org.raml.v2.api.model.v10.datamodel.XMLTypeDeclaration) TypeName(com.squareup.javapoet.TypeName) V10RamlToPojoGType(org.raml.jaxrs.generator.v10.types.V10RamlToPojoGType) JSONTypeDeclaration(org.raml.v2.api.model.v10.datamodel.JSONTypeDeclaration)

Aggregations

TypeName (com.squareup.javapoet.TypeName)4 V10RamlToPojoGType (org.raml.jaxrs.generator.v10.types.V10RamlToPojoGType)4 JSONTypeDeclaration (org.raml.v2.api.model.v10.datamodel.JSONTypeDeclaration)2 XMLTypeDeclaration (org.raml.v2.api.model.v10.datamodel.XMLTypeDeclaration)2