The following code is used in Spring - Hibernate Full Java Based Configuration in many places (like here):
Properties hibernateProperties() {
return new Properties() {
{
setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLDialect");
setProperty("hibernate.show_sql", "true");
setProperty("hibernate.format_sql", "true");
setProperty("use_sql_comments", "true");
setProperty("hibernate.hbm2ddl.auto", "none");
}
};
}
This is a method in a class. I think that the return object is an anonymous class object (Please tell me if I'm wrong). What is with the curly brackets enclosing the setProperty statements? Is that an array? If so there should not be any semi-colons in there?
I haven't been able to find any place where this syntax is explained. Please give some link where this explained in detail.