use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Element in project ds3_autogen by SpectraLogic.
the class StructConverter method convertDs3Elements.
private static ImmutableList<StructMember> convertDs3Elements(final ImmutableList<Ds3Element> elementsList, final ImmutableSet<String> enumNames, final boolean isPaginated) throws ParseException {
final ImmutableList.Builder<StructMember> builder = ImmutableList.builder();
for (final Ds3Element currentElement : elementsList) {
final C_Type elementType = C_TypeHelper.convertDs3ElementType(currentElement, enumNames);
builder.add(new StructMember(elementType, StructHelper.getNameUnderscores(currentElement.getName()), Ds3ElementUtil.getXmlTagName(currentElement), Ds3ElementUtil.getEncapsulatingTagAnnotations(currentElement.getDs3Annotations()), Ds3ElementUtil.isAttribute(currentElement.getDs3Annotations()), hasWrapper(currentElement)));
if (elementType.isArray()) {
builder.add(new StructMember(new PrimitiveType("size_t", false), "num_" + StructHelper.getNameUnderscores(currentElement.getName())));
}
if (isPaginated) {
builder.add(new StructMember(new FreeableType("ds3_paging", false), "paging"));
}
}
return builder.build();
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Element in project ds3_autogen by SpectraLogic.
the class C_Type_Test method testStructTypeDs3ResponseToString.
@Test
public void testStructTypeDs3ResponseToString() throws java.text.ParseException {
final Ds3Element testElement = new Ds3Element("BuildInformation", "com.spectralogic.s3.common.platform.lang.BuildInformation", null, false);
final C_Type c_type = C_TypeHelper.convertDs3ElementType(testElement, ImmutableSet.of());
assertThat(c_type.getTypeName(), is("ds3_build_information_response"));
assertThat(c_type.toString(), is("ds3_build_information_response*"));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Element in project ds3_autogen by SpectraLogic.
the class C_Type_Test method testStructMemberTypeStringToString.
@Test
public void testStructMemberTypeStringToString() throws java.text.ParseException {
final Ds3Element testElement = new Ds3Element("stringElement", "java.lang.String", null, false);
final C_Type c_type = C_TypeHelper.convertDs3ElementType(testElement, ImmutableSet.of());
assertThat(c_type.getTypeName(), is("ds3_str"));
assertThat(c_type.toString(), is("ds3_str*"));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Element in project ds3_autogen by SpectraLogic.
the class C_Type_Test method testStructTypeIntToString2.
@Test
public void testStructTypeIntToString2() throws java.text.ParseException {
final Ds3Element testElement = new Ds3Element("intStruct2", "java.lang.Integer", null, true);
final C_Type c_type = C_TypeHelper.convertDs3ElementType(testElement, ImmutableSet.of());
assertThat(c_type.getTypeName(), is("int"));
assertThat(c_type.toString(), is("int"));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Element in project ds3_autogen by SpectraLogic.
the class C_Type_Test method testStructMemberTypeDoubleToString.
@Test
public void testStructMemberTypeDoubleToString() throws java.text.ParseException {
final Ds3Element testElement = new Ds3Element("doubleElement", "double", null, false);
final C_Type c_type = C_TypeHelper.convertDs3ElementType(testElement, ImmutableSet.of());
assertThat(c_type.getTypeName(), is("float"));
assertThat(c_type.toString(), is("float"));
}
Aggregations