Saturday Aug 25, 2007

NetBeans 6 Web Service Designer

NetBeans has introduced a Web Service designer, as you may have seen in Geertjan's blog. In addition to the ability to graphically view and modify operations for implementation first web services (WSDL is generated based on the JAXWS annotations), the web service designer provides the ability to work incrementally starting from a WSDL document. This represents a significant enhancement to the development experience as the WSDL document can become a first class source artifact, while the developer experience remains the same as the Web service designer provides the same implementation
 view. The add operation feature has also been extended to support the direct addition of XML schema. Direct addition of schema elements will perform an on demand generation of JAXB to provide a Java binding.


 

 Having the WSDL generated as part of deployment presents makes it difficult for composite application assembly tools, such as  the NetBeans CASA editor, to take advantage of the abstract WSDL binding capability of the openESB runtime. A composite application provides code composition based on well defined WSDL based interfaces. Since all the modules are deployed together and each WSDL interface is exposed on the service bus, developers can rely on bus endpoints instead of the concrete endpoints exposed in WSDL, thus achieving loose coupling as only the abstract WSDL is needed. The WSDL document can also be modified using the NetBeans WSDL editor to enhance the generated information such as adding documentation.

You will also notice the ability to see sample input and output messages. This is useful when working from Java types to see  how changes to the structure of Java classes will affect the XML messages.

This new feature is worth a look, you can find this in NetBeans 6.  




Sunday Feb 11, 2007

Difference between extends and super In generic collections

The guidelines I have been using to differentiate when to use extends v. super are the following:

  • Use extends if you need to read from the collection (i.e. List<? extends A>;). This will ensure that the collection itself contains items which extends A. This is read-only because there is no way to determine the exact type to add to the collection (the parameter could be List<B> and there would be no way of ensure the type safety of an addition).
  • Use super  if you want to write to the collection (i.e. List<? super A>;). In this case, the collection can support addition of A types as we know the specified type of the collection is a super class of A. Therefore, A typed items can always be added to the collection.


Here is some code to look at:

import java.util.List;

public class GenericTest {
   
    private void useExtends(List<? extends SomeInterface> l) {
        for (SomeInterface i:l) {
           
        }
       
        // below doesn't compile because the exact type of list isn't known
        l.add(new SomeInterface(){});
    }
   
    private void useSuper(List<? super SomeInterface> l) {
        // the for loop below doesn't compile as the List is one of the super
        // type of SomeInterface but unknown as to which one
        // Object could be used in the for loop
        for (SomeInterface i:l) {
           
        }
       
        l.add(new SomeInterface(){});
    }
   
    interface SomeInterface {}
   
}
 



About

cwebster

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today