• Post Reply Bookmark Topic Watch Topic
  • New Topic

Query related to com.bea.xml.XmlObject

 
Sat Nar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i came across the below code and iam having some doubts in it.

1. XmlObject[] detail = buildDetail();

2. private XmlObject[] buildDetail()
{
return new XmlObject[]{buildCustomFaultException()};
//return new XmlObject[]{//XmlObject returned by the above function}
}

//the function buildCustomFaultException returns a XmlObject

3.private XmlObject buildCustomFaultException()

My doubt is according the specification http://edocs.bea.com/workshop/docs81/doc/en/core/index.html XmlObject is an interface.So how do we specify return new XmlObject[] in step2?

Also what does the paranthesis in the statement return new XmlObject[]{buildCustomFaultException()} signify?

Kindly help me out.
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sat Nar:
Also what does the parenthesis in the statement return new XmlObject[]{buildCustomFaultException()} signify?

It's an anonymous array with an array initializer block.
Arrays -- intermediate

"new XmlObject[2]" simply creates an array that can reference objects that expose the XmlObject interface � no actualinstances are created.
"XmlObject[]{buildCustomFaultException()}" - buildCustomFaultException() instantiates a single object that exposes the XmlObject interface and returns it. That is the only instance that appears in the array initializer block so a one element array is created. That one element is an object reference to the object that exposes the XmlObject interface.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!