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

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -