spring - Strange JAVA Syntax -
the following code 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 method in class. think return object anonymous class object (please tell me if i'm wrong). curly brackets enclosing setproperty statements? array? if there should not semi-colons in there?
i haven't been able find place syntax explained. please give link explained in detail.
this method returns object of type properties
. method creates anonymous class defines instance initializer block sets properties in returned object:
return new properties() { // instance initializer block pre-sets 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"); } };
it creates properties
object predefined properties.
Comments
Post a Comment