/
DmfSoftwareModule.java
93 lines (76 loc) · 2.44 KB
/
DmfSoftwareModule.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.dmf.json.model;
import java.util.Collections;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* JSON representation of a software module.
*
*/
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class DmfSoftwareModule {
@JsonProperty
private Long moduleId;
@JsonProperty
private String moduleType;
@JsonProperty
private String moduleVersion;
@JsonProperty
private List<DmfArtifact> artifacts;
@JsonProperty
private List<DmfMetadata> metadata;
public String getModuleType() {
return moduleType;
}
public void setModuleType(final String moduleType) {
this.moduleType = moduleType;
}
public String getModuleVersion() {
return moduleVersion;
}
public void setModuleVersion(final String moduleVersion) {
this.moduleVersion = moduleVersion;
}
public List<DmfArtifact> getArtifacts() {
if (artifacts == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(artifacts);
}
public Long getModuleId() {
return moduleId;
}
@JsonIgnore
public void setModuleId(final Long moduleId) {
this.moduleId = moduleId;
}
public void setArtifacts(final List<DmfArtifact> artifacts) {
this.artifacts = artifacts;
}
public List<DmfMetadata> getMetadata() {
return metadata;
}
public void setMetadata(final List<DmfMetadata> metadata) {
if (metadata != null && !metadata.isEmpty()) {
this.metadata = metadata;
}
}
@Override
public String toString() {
return String.format(
"DmfSoftwareModule [moduleId=%d, moduleType='%s', moduleVersion='%s', artifacts=%s, metadata=%s]",
moduleId, moduleType, moduleVersion, artifacts, metadata);
}
}