code_junkie

Is it impossible to perform initialization before calling a superclass's constructor?

Nov 13th, 2011
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. private MyObject(ComplexData data)
  2. {
  3. super(data);
  4. }
  5.  
  6. public static MyObject createMyObject(String someParameter)
  7. {
  8. ComplexData data = XMLParser.createData(someParameter);
  9. return new MyObject(data);
  10. }
  11.  
  12. public Subclass(String filename)
  13. {
  14. super(loadFile(filename));
  15. }
  16.  
  17. private static byte[] loadFile(String filename)
  18. {
  19. // ...
  20. }
  21.  
  22. public MyObject(String parm) {
  23. super(parseComplex(parm));
  24. }
  25.  
  26. private static ComplexData parseComplex(String parm) {
  27. ....
  28. return new ComplexData(...);
  29. }
Add Comment
Please, Sign In to add comment