PageRenderTime 46ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/src/main/java/com/atlassian/jira/plugins/bitbucket/spi/DefaultBitbucketChangesetFile.java

https://bitbucket.org/atlassian/jira-bitbucket-connector/
Java | 70 lines | 58 code | 11 blank | 1 comment | 6 complexity | 7e9a80c3afcf47b56d03181453fcfa97 MD5 | raw file
  1. package com.atlassian.jira.plugins.bitbucket.spi;
  2. import com.atlassian.jira.plugins.bitbucket.api.ChangesetFile;
  3. import com.atlassian.jira.plugins.bitbucket.api.ChangesetFileAction;
  4. import org.apache.commons.lang.builder.EqualsBuilder;
  5. import org.apache.commons.lang.builder.HashCodeBuilder;
  6. public class DefaultBitbucketChangesetFile implements ChangesetFile
  7. {
  8. private final ChangesetFileAction type;
  9. private final String file;
  10. private final int additions;
  11. private final int deletions;
  12. public DefaultBitbucketChangesetFile(ChangesetFileAction type, String file, int additions, int deletions)
  13. {
  14. this.type = type;
  15. this.file = file;
  16. this.additions = additions;
  17. this.deletions = deletions;
  18. }
  19. public ChangesetFileAction getFileAction()
  20. {
  21. return type;
  22. }
  23. public String getFile()
  24. {
  25. return file;
  26. }
  27. // TODO add func tests for additions and deletions
  28. public int getAdditions()
  29. {
  30. return additions;
  31. }
  32. public int getDeletions()
  33. {
  34. return deletions;
  35. }
  36. @Override
  37. public boolean equals(Object o)
  38. {
  39. if (this == o) return true;
  40. if (o == null || getClass() != o.getClass()) return false;
  41. DefaultBitbucketChangesetFile that = (DefaultBitbucketChangesetFile) o;
  42. return new EqualsBuilder()
  43. .append(type, that.type)
  44. .append(file, that.file)
  45. .append(additions, that.additions)
  46. .append(deletions, that.deletions)
  47. .isEquals();
  48. }
  49. @Override
  50. public int hashCode()
  51. {
  52. return new HashCodeBuilder()
  53. .append(type)
  54. .append(file)
  55. .append(additions)
  56. .append(deletions)
  57. .hashCode();
  58. }
  59. }