##### Coverage Report - jp.co.y_net.amm.dao.Grp

Classes in this File | Line Coverage | Branch Coverage | Complexity

Grp

0% | 0/13

N/A | N/A

1.5;1.5

Grp$CreatedateComparator

0% | 0/13

0% | 0/10

1.5;1.5

1

0

     package jp.co.y_net.amm.dao;

2

3

     import java.io.Serializable;

4

     import java.util.Comparator;

5

6

7

0

     public class Grp extends AppDto implements Serializable {

8

9

         private static final long serialVersionUID = 1L;

10

11

         /* DBMSと連携するメンバ */

12

         private Integer grpid;

13

         private String name;

14

         private Integer adminusrid;

15

         private Long createdate;

16

17

18

         /* アプリケーションで設定するメンバ */

19

         // なし

20

21

         /* 自動生成のアクセサ */

22

         public Integer getGrpid() {

23

0

             return grpid;

24

         }

25

         public void setGrpid(Integer grpid) {

26

0

             this.grpid = grpid;

27

0

         }

28

         public String getName() {

29

0

             return name;

30

         }

31

         public void setName(String name) {

32

0

             this.name = name;

33

0

         }

34

         public Integer getAdminusrid() {

35

0

             return adminusrid;

36

         }

37

         public void setAdminusrid(Integer adminusrid) {

38

0

             this.adminusrid = adminusrid;

39

0

         }

40

         public Long getCreatedate() {

41

0

             return createdate;

42

         }

43

         public void setCreatedate(Long createdate) {

44

0

             this.createdate = createdate;

45

0

         }

46

         /* 自動生成のアクセサ -end */

47

48

         /* 型変換のアクセサ */

49

         /* 型変換のアクセサ - end */

50

51

52

53

         /**

54

          * 作成日時のソートに用いるComparator

55

          */

56

         public static class CreatedateComparator implements Comparator<Grp> {

57

             /** trueに変更すると 申請日時の新しい順 */

58

0

             private boolean desc = false;

59

60

0

             public CreatedateComparator(boolean desc) {

61

0

                 this.desc = desc;

62

0

             }

63

64

             @Override

65

             public int compare(Grp o1, Grp o2) {

66

0

                 int reverse = 1;

67

0

                 if(desc) {

68

0

                     reverse = -1;

69

                 }

70

71

0

                 Long n1 = 0L;

72

0

                 Long n2 = 0L;

73

0

                 if(o1 != null && o1.getCreatedate() != null) n1 = o1.getCreatedate();

74

0

                 if(o2 != null && o2.getCreatedate() != null) n2 = o2.getCreatedate();

75

76

0

                 return Long.compare(n1, n2) * reverse;

77

             }

78

         }

79

     }

80