Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. ApplicationData appData = ApplicationDataFactory.getCurrentApplicationData();
  2.  
  3. class ApplicationDataFactory
  4. {
  5. public static ApplicationData getCurrentApplicationData()
  6. {
  7.  
  8. //notice how im not passing in criteria here, im getting it from the request so call doens't have to know
  9. String criteria = request.getHTTPHeaderInfo("applicationID");
  10.  
  11. if ( criteria.equals("Android") )
  12. return new Android();
  13.  
  14. else if ( criteria.equals("Android-germany") )
  15. return new Android_germany();
  16.  
  17. else if ( criteria.equals("ios_germany") )
  18. return new ios_germany();
  19.  
  20. else if ( criteria.equals("ios"))
  21. return new ios();
  22.  
  23. else if ( criteria.equals("windows") )
  24. return new windows();
  25.  
  26. return null;//or throw exception
  27. }
  28. }
  29.  
  30. class Android extends ApplicationData{
  31.  
  32. @override
  33. public String getType(){
  34. return "Android"
  35. }
  36. @override
  37. public Properties getProperties{
  38. return system.getProperties("android.properties");
  39.  
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement