You can create a base class (extending from ViewObjectImpl) with the magic code and extend to other classes.
See this: http://mahmoudoracle.blogspot.com.es/2011/08/adf-business-component-base-classes.html