1 package com.atlassian.plugin.web.api.model;
2
3 import com.atlassian.plugin.web.api.WebFragment;
4
5 import javax.annotation.Nonnull;
6 import java.util.Map;
7
8 public abstract class AbstractWebFragment implements WebFragment {
9 private final String completeKey;
10 private final String label;
11 private final String title;
12 private final String styleClass;
13 private final String id;
14 private final Map<String, String> params;
15 private final int weight;
16
17 protected AbstractWebFragment(final String completeKey, final String label, final String title, final String styleClass, final String id, final Map<String, String> params, final int weight) {
18 this.completeKey = completeKey;
19 this.label = label;
20 this.title = title;
21 this.styleClass = styleClass;
22 this.id = id;
23 this.params = params;
24 this.weight = weight;
25 }
26
27 @Override
28 public String getCompleteKey() {
29 return completeKey;
30 }
31
32 @Override
33 public String getLabel() {
34 return label;
35 }
36
37 @Override
38 public String getTitle() {
39 return title;
40 }
41
42 @Override
43 public String getStyleClass() {
44 return styleClass;
45 }
46
47 @Override
48 public String getId() {
49 return id;
50 }
51
52 @Nonnull
53 @Override
54 public Map<String, String> getParams() {
55 return params;
56 }
57
58 @Override
59 public int getWeight() {
60 return weight;
61 }
62
63 @Override
64 public String toString() {
65 return getClass().getName() + "{" + toStringOfFields() + "}";
66 }
67
68 protected String toStringOfFields() {
69 return "completeKey=" + completeKey + ", label=" + label + ", title=" + title + ", styleClass=" + styleClass
70 + ", id=" + id + ", params=" + params + ", weight=" + weight;
71 }
72 }