use of org.raml.v2.api.model.v10.datamodel.TypeDeclaration in project raml-for-jax-rs by mulesoft-labs.
the class AnnotationsTest method get.
@Test
public void get() throws Exception {
TypeDeclaration type = buildType(this, "annotations.raml", 0);
assertEquals("Allo", Annotations.CLASS_NAME.get(type));
}
use of org.raml.v2.api.model.v10.datamodel.TypeDeclaration in project raml-for-jax-rs by mulesoft-labs.
the class TypeUtilsTest method shouldExtendingAnotherMultipleInheritance.
@Test
public void shouldExtendingAnotherMultipleInheritance() throws Exception {
Map<String, GType> finder = finder("extendObjectMultipleIneritance.raml");
ObjectTypeDeclaration object = (ObjectTypeDeclaration) finder.get("ObjectOne").implementation();
TypeDeclaration extending = findProperty(object, "name");
ObjectTypeDeclaration extended = (ObjectTypeDeclaration) finder.get(extending.type());
assertTrue(TypeUtils.shouldCreateNewClass(extending, extended));
}
use of org.raml.v2.api.model.v10.datamodel.TypeDeclaration in project raml-for-jax-rs by mulesoft-labs.
the class TypeUtilsTest method shouldExtendingAnother.
@Test
public void shouldExtendingAnother() throws Exception {
Map<String, GType> finder = finder("extendingAnother.raml");
ObjectTypeDeclaration object = (ObjectTypeDeclaration) finder.get("ObjectOne").implementation();
TypeDeclaration extending = findProperty(object, "name");
ObjectTypeDeclaration extended = (ObjectTypeDeclaration) finder.get(extending.type()).implementation();
assertFalse(TypeUtils.shouldCreateNewClass(extending, extended));
}
use of org.raml.v2.api.model.v10.datamodel.TypeDeclaration in project raml-for-jax-rs by mulesoft-labs.
the class V10Finder method typesInBodies.
private void typesInBodies(Resource resource, Method method, List<TypeDeclaration> body, GFinderListener listener) {
for (TypeDeclaration typeDeclaration : body) {
if (!isInline(typeDeclaration)) {
continue;
}
V10GType type = createInlineFromResourcesAndSuch(Names.ramlTypeName(resource, method, typeDeclaration), Names.javaTypeName(resource, method, typeDeclaration), typeDeclaration);
listener.newTypeDeclaration(type);
}
for (TypeDeclaration parameterTypeDeclaration : method.queryParameters()) {
if (!isInline(parameterTypeDeclaration)) {
continue;
}
V10GType type = createInlineFromResourcesAndSuch(Names.ramlTypeName(resource, method, parameterTypeDeclaration), Names.javaTypeName(resource, method, parameterTypeDeclaration), parameterTypeDeclaration);
listener.newTypeDeclaration(type);
}
for (TypeDeclaration headerType : method.headers()) {
if (!isInline(headerType)) {
continue;
}
V10GType type = createInlineFromResourcesAndSuch(Names.ramlTypeName(resource, method, headerType), Names.javaTypeName(resource, method, headerType), headerType);
listener.newTypeDeclaration(type);
}
for (Response response : method.responses()) {
for (TypeDeclaration typeDeclaration : response.body()) {
if (!isInline(typeDeclaration)) {
continue;
}
V10GType type = createInlineFromResourcesAndSuch(Names.ramlTypeName(resource, method, response, typeDeclaration), Names.javaTypeName(resource, method, response, typeDeclaration), typeDeclaration);
listener.newTypeDeclaration(type);
}
}
}
use of org.raml.v2.api.model.v10.datamodel.TypeDeclaration in project raml-for-jax-rs by mulesoft-labs.
the class V10Finder method goThroughLibraries.
private void goThroughLibraries(Set<String> visitedLibraries, List<Library> libraries, GFinderListener listener) {
for (Library library : libraries) {
if (visitedLibraries.contains(library.name())) {
continue;
} else {
visitedLibraries.add(library.name());
}
goThroughLibraries(visitedLibraries, library.uses(), listener);
for (TypeDeclaration typeDeclaration : library.types()) {
V10GType type = createTypeFromLibraryPart(typeDeclaration);
listener.newTypeDeclaration(type);
}
}
}
Aggregations