Search in sources :

Example 1 with NullableElement

use of com.spectralogic.ds3autogen.net.generators.parsers.element.NullableElement in project ds3_autogen by SpectraLogic.

the class BaseTypeParserGenerator_Test method toNullableElementsList_FullList_Test.

@Test
public void toNullableElementsList_FullList_Test() {
    final ImmutableList<Ds3Element> elements = ImmutableList.of(new Ds3Element("Name1", "int", "", false), new Ds3Element("Name2", "Type", "Component", false));
    final ImmutableList<NullableElement> result = generator.toNullableElementsList(elements, false);
    assertThat(result.size(), is(2));
    assertThat(result.get(0), instanceOf(BaseNullableElement.class));
    assertThat(result.get(1), instanceOf(NullableListElement.class));
}
Also used : NullableListElement(com.spectralogic.ds3autogen.net.generators.parsers.element.NullableListElement) BaseNullableElement(com.spectralogic.ds3autogen.net.generators.parsers.element.BaseNullableElement) NullableElement(com.spectralogic.ds3autogen.net.generators.parsers.element.NullableElement) Ds3Element(com.spectralogic.ds3autogen.api.models.apispec.Ds3Element) BaseNullableElement(com.spectralogic.ds3autogen.net.generators.parsers.element.BaseNullableElement) Test(org.junit.Test)

Example 2 with NullableElement

use of com.spectralogic.ds3autogen.net.generators.parsers.element.NullableElement in project ds3_autogen by SpectraLogic.

the class BaseTypeParserGenerator_Test method toNullableElement_Test.

@Test
public void toNullableElement_Test() {
    final Ds3Element element = new Ds3Element("Name", "int", "", false);
    final NullableElement result = toNullableElement(element, false);
    assertThat(result, instanceOf(BaseNullableElement.class));
}
Also used : BaseNullableElement(com.spectralogic.ds3autogen.net.generators.parsers.element.BaseNullableElement) NullableElement(com.spectralogic.ds3autogen.net.generators.parsers.element.NullableElement) Ds3Element(com.spectralogic.ds3autogen.api.models.apispec.Ds3Element) BaseNullableElement(com.spectralogic.ds3autogen.net.generators.parsers.element.BaseNullableElement) Test(org.junit.Test)

Example 3 with NullableElement

use of com.spectralogic.ds3autogen.net.generators.parsers.element.NullableElement in project ds3_autogen by SpectraLogic.

the class JobListParserGenerator_Test method toJobsNullableElement_Test.

@Test
public void toJobsNullableElement_Test() {
    final NullableElement result = toJobsNullableElement(getJobsElement());
    assertThat(result, instanceOf(NullableListElement.class));
    assertThat(result.printParseElement(), is("Jobs = element.Elements(\"Job\").Select(ParseJobList).ToList()"));
}
Also used : NullableListElement(com.spectralogic.ds3autogen.net.generators.parsers.element.NullableListElement) NullableElement(com.spectralogic.ds3autogen.net.generators.parsers.element.NullableElement) JobListParserGenerator.toJobsNullableElement(com.spectralogic.ds3autogen.net.generators.parsers.type.JobListParserGenerator.toJobsNullableElement) Test(org.junit.Test)

Example 4 with NullableElement

use of com.spectralogic.ds3autogen.net.generators.parsers.element.NullableElement in project ds3_autogen by SpectraLogic.

the class BaseTypeParserGenerator method toParseElements.

/**
     * Converts a list of Ds3Elements into their .net parsing code
     */
@Override
public ImmutableList<String> toParseElements(final ImmutableList<Ds3Element> ds3Elements, final boolean isObjectsType) {
    final ImmutableList<NullableElement> elements = toNullableElementsList(ds3Elements, isObjectsType);
    if (isEmpty(elements)) {
        return ImmutableList.of();
    }
    final ImmutableList.Builder<String> builder = ImmutableList.builder();
    for (final NullableElement nullableElement : elements) {
        builder.add(nullableElement.printParseElement());
    }
    return builder.build();
}
Also used : ImmutableList(com.google.common.collect.ImmutableList) NetNullableElementUtils.createNullableElement(com.spectralogic.ds3autogen.net.utils.NetNullableElementUtils.createNullableElement) NullableElement(com.spectralogic.ds3autogen.net.generators.parsers.element.NullableElement)

Aggregations

NullableElement (com.spectralogic.ds3autogen.net.generators.parsers.element.NullableElement)4 Test (org.junit.Test)3 Ds3Element (com.spectralogic.ds3autogen.api.models.apispec.Ds3Element)2 BaseNullableElement (com.spectralogic.ds3autogen.net.generators.parsers.element.BaseNullableElement)2 NullableListElement (com.spectralogic.ds3autogen.net.generators.parsers.element.NullableListElement)2 ImmutableList (com.google.common.collect.ImmutableList)1 JobListParserGenerator.toJobsNullableElement (com.spectralogic.ds3autogen.net.generators.parsers.type.JobListParserGenerator.toJobsNullableElement)1 NetNullableElementUtils.createNullableElement (com.spectralogic.ds3autogen.net.utils.NetNullableElementUtils.createNullableElement)1