dimanche 21 octobre 2018

How to create complex object using builder pattern in java?

I have a request object for SOAP request.Need to implement builder class for the request object SampleRequest.

    <SampleRequest xmlns="http://demoservice.get">
        <RequestHeader>
            <RequestID>abcd123123123123</RequestID>
            <RequestSentTimestamp>2018-03-26T05:51:02.803-04:00</RequestSentTimestamp>
            <Requestor>
                <Travelor>test traveler</Travelor>
                <ageName>age name</ageName>
                <Username>TestUser</Username>
            </Requestor>
        </RequestHeader>
        <RequestBody>
            <Property>
                <Address>
                    <AddressID>1</AddressID>
                    <StreetName>123, Main st</StreetName>
                    <Municipality>amelia</Municipality>
                    <Province>OH</Province>
                    <PostalCode>55120</PostalCode>
                </Address>  
                <Business>              
                    <IndusCodes>
                        <ICode>0110</ICode>
                        <NCCode>111910</NCCode>
                        <SCode>0139</SCode>
                    </IndusCodes>
                </Business>    
            </Property>    
            <RequestedProducts>
                <ProductName>Sample Out</ProductName>
            </RequestedProducts>
        </RequestBody>
    </SampleRequest>

I am pretty much new to Java. Any help would be appreciated. Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire