Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

curly braces inside parameter call. >> what does it mean? | Spring 3 and GWT

Tags:

java

spring

gwt

question

When the code segment "new TextColumn(){...}, "MyObjectId");" executes then what does the code inside the outermost of pair curly braces represent? Does it represent an anonymous inner class instance of the TextColumn object? Does it represent the definition of the TextColumn object?

code

table.addColumn(new TextColumn<MyObjectProxy>() {
    Renderer<Integer> renderer = new AbstractRenderer<Integer>() {
        public String render(Integer obj) {
            return obj == null ? "" : String.valueOf(obj);
        }
    };
    @Override
    public String getValue(MyObjectProxy object) {
        return renderer.render(object.getMyObjectId());
    }
}, "MyObjectId");

if you are wondering the TextColumn is from the com.google.gwt.user.cellview.client.TextColumn package.

like image 360
Kent Bull Avatar asked Feb 17 '23 08:02

Kent Bull


1 Answers

That's an anonymous inner class that extends TextColumn<MyObjectProxy>. In it, it has a field named renderer of type Renderer<Integer> that is initialized with an instance of an anonymous inner class that extends AbstractRenderer<Integer>. There is also an override of method getValue below that.

like image 167
Alan Krueger Avatar answered Mar 22 '23 22:03

Alan Krueger