Clover icon

sunshower-core

  1. Project Clover database Fri Apr 6 2018 03:27:42 UTC
  2. Package io.sunshower.service.model

File AbstractEntityLink.java

 

Coverage histogram

../../../../img/srcFileCovDistChart8.png
14% of files have more coverage

Code metrics

0
12
9
1
68
53
9
0.75
1.33
9
1

Classes

Class Line # Actions
8 12 9
0.809523881%
 

Contributing tests

This file is covered by 1 test. .

Source view

1    package io.sunshower.service.model;
2   
3    import io.sunshower.persistence.core.DistributableEntity;
4    import javax.persistence.*;
5   
6    @MappedSuperclass
7    @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
 
8    public abstract class AbstractEntityLink<
9    T extends DistributableEntity, U extends DistributableEntity>
10    extends DistributableEntity implements Link<T, U> {
11   
12    @OneToOne(fetch = FetchType.LAZY)
13    private T source;
14   
15    @OneToOne(fetch = FetchType.LAZY)
16    private U target;
17   
18    @Enumerated
19    @Column(name = "mode")
20    private LinkageMode mode;
21   
22    @Enumerated
23    @Column(name = "type")
24    private RelationshipType type;
25   
 
26  1 toggle public AbstractEntityLink(T source, U target, LinkageMode mode, RelationshipType type) {
27  1 setSource(source);
28  1 setTarget(target);
29  1 setMode(mode);
30  1 setType(type);
31    }
32   
 
33  1 toggle @Override
34    public T getSource() {
35  1 return source;
36    }
37   
 
38  1 toggle @Override
39    public U getTarget() {
40  1 return target;
41    }
42   
 
43  0 toggle @Override
44    public LinkageMode getLinkageMode() {
45  0 return mode;
46    }
47   
 
48  0 toggle @Override
49    public RelationshipType getRelationshipType() {
50  0 return type;
51    }
52   
 
53  1 toggle protected void setSource(T source) {
54  1 this.source = source;
55    }
56   
 
57  1 toggle protected void setTarget(U target) {
58  1 this.target = target;
59    }
60   
 
61  1 toggle protected void setMode(LinkageMode mode) {
62  1 this.mode = mode;
63    }
64   
 
65  1 toggle protected void setType(RelationshipType type) {
66  1 this.type = type;
67    }
68    }