refactoring to support java dsl
refactoring to support java dsl