Search This Blog

Friday, February 8, 2013

Java generic methods; Java generic classes; Java static generic method

Java has a different syntax for generic methods, generic classes and static generic methods.

  • Java generic classes
public class ComboBoxDefinition<T extends Identifiable> extends AbstractFieldDefinition implements xxxx
{
    protected ComboBoxDefinition(BeanContainer<T> beanContainer)
    {
    }
}
  • Java generic methods
public class ComboBoxDefinition
{
    public void draw(List<? extends Control> controls) {
    }
}
  • Java static generic methods
public class SomeClass
{
     public static <T extends Identifiable> void create(BeanContainer<T> beanContainer) {
        
    }
}

2 comments:

If you like this post, please leave a comment :)