Skip to content
This repository was archived by the owner on Jun 19, 2024. It is now read-only.

Commit 604fb22

Browse files
committed
javadoc
1 parent e1e20dc commit 604fb22

File tree

2 files changed

+135
-6
lines changed

2 files changed

+135
-6
lines changed

src/main/java/com/oneandone/go/plugin/maven/message/PackageMaterialProperties.java

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,76 @@
88
import java.util.LinkedHashMap;
99
import java.util.Map;
1010

11-
11+
/** Representation of configuration properties. */
1212
@NoArgsConstructor(access = AccessLevel.PUBLIC)
1313
public class PackageMaterialProperties {
1414

15-
private Map<String, PackageMaterialProperty> propertyMap = new LinkedHashMap<String, PackageMaterialProperty>();
15+
/** The property map. */
16+
private Map<String, PackageMaterialProperty> propertyMap = new LinkedHashMap<>();
1617

17-
public PackageMaterialProperties(Map<String, PackageMaterialProperty> propertyMap) {
18+
/**
19+
* Constructs a new instance of configuration properties.
20+
*
21+
* @param propertyMap the property map
22+
*/
23+
public PackageMaterialProperties(final Map<String, PackageMaterialProperty> propertyMap) {
1824
this.propertyMap = propertyMap;
1925
}
2026

21-
public void addPackageMaterialProperty(String key, PackageMaterialProperty packageMaterialProperty) {
27+
/**
28+
* Add a new property.
29+
*
30+
* @param key the property key
31+
* @param packageMaterialProperty the property definition
32+
*/
33+
public void addPackageMaterialProperty(final String key, final PackageMaterialProperty packageMaterialProperty) {
2234
propertyMap.put(key, packageMaterialProperty);
2335
}
2436

25-
public PackageMaterialProperty getProperty(String key) {
37+
/**
38+
* Returns the property definition for the specified {@code key}.
39+
*
40+
* @param key the key
41+
* @return the property definition or {@code null}
42+
*/
43+
public PackageMaterialProperty getProperty(final String key) {
2644
return propertyMap.get(key);
2745
}
2846

29-
public boolean hasKey(String key) {
47+
/**
48+
* Returns {@code true} if a property definition for the specified {@code key} is defined, otherwise {@code false}.
49+
*
50+
* @param key the key
51+
* @return {@code true} if a property definition for the specified {@code key} is defined, otherwise {@code false}
52+
*/
53+
public boolean hasKey(final String key) {
3054
return propertyMap.keySet().contains(key);
3155
}
3256

57+
/**
58+
* Returns a collection of all property keys.
59+
*
60+
* @return collection of all property keys
61+
*/
3362
public Collection<String> keys() {
3463
return propertyMap.keySet();
3564
}
3665

66+
/**
67+
* Returns the property map.
68+
*
69+
* @return the property map
70+
*/
3771
public Map<String, PackageMaterialProperty> getPropertyMap() {
3872
return propertyMap;
3973
}
4074

75+
/**
76+
* Returns an {@link Optional} for the value of the property for the specified {@code key}.
77+
*
78+
* @param key the key
79+
* @return {@link Optional} for the value of the property for the specified {@code key}
80+
*/
4181
public Optional<String> getValue(final String key) {
4282
if (hasKey(key) && getProperty(key).getValue() != null && !getProperty(key).getValue().trim().isEmpty()) {
4383
return Optional.of(getProperty(key).getValue());

src/main/java/com/oneandone/go/plugin/maven/message/PackageMaterialProperty.java

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,64 +4,153 @@
44
import com.google.gson.annotations.SerializedName;
55
import lombok.Getter;
66

7+
/** Representation of a configuration property definition. */
78
public class PackageMaterialProperty {
89

10+
/**
11+
* The default value for {@code this} property.
12+
*
13+
* @return the default value for {@code this} property
14+
*/
915
@Expose @SerializedName("default-value")
1016
@Getter private String defaultValue;
1117

18+
/**
19+
* The value for {@code this} property.
20+
*
21+
* @return the value for {@code this} property
22+
*/
1223
@Expose
1324
@Getter private String value;
1425

26+
/**
27+
* Flag indicating whether the content of {@code this} property value should be displayed hidden.
28+
*
29+
* @return {@code true} if value should be hidden, otherwise {@code false}
30+
*/
1531
@Expose
1632
@Getter private Boolean secure;
1733

34+
/**
35+
* Flag indicating whether {@code this} property is part of the configuration identifier.
36+
*
37+
* @return {@code true} if {@code this} property is part of the identity, otherwise {@code false}
38+
*/
1839
@Expose @SerializedName("part-of-identity")
1940
@Getter private Boolean partOfIdentity;
2041

42+
/**
43+
* FLag indicating whether a value for {@code this} property is required
44+
*
45+
* @return {@code true} if value is required, otherwise {@code false}
46+
*/
2147
@Getter private Boolean required;
2248

49+
/**
50+
* The display name for {@code this} property.
51+
*
52+
* @return the display name for {@code this} property
53+
*/
2354
@Expose @SerializedName("display-name")
2455
@Getter private String displayName;
2556

57+
/**
58+
* The display order for {@code this} property.
59+
*
60+
* @return the display order for {@code this} property
61+
*/
2662
@Expose @SerializedName("display-order")
2763
@Getter private String displayOrder;
2864

65+
/**
66+
* Constructs a property.
67+
* <p />
68+
* All {@code boolean} properties are set to {@code false} as default value.
69+
*/
2970
public PackageMaterialProperty() {
3071
this.secure = false;
3172
this.partOfIdentity = false;
3273
this.required = false;
3374
}
3475

76+
/**
77+
* Sets whether value should be hidden.
78+
* <p />
79+
* Default is {@code false}.
80+
*
81+
* @param secure {@code true} if value should be hidden, otherwise {@code false}
82+
* @return {@code this} property
83+
*/
3584
public PackageMaterialProperty withSecure(final boolean secure) {
3685
this.secure = secure;
3786
return this;
3887
}
3988

89+
/**
90+
* Sets whether property is part of identity.
91+
* <p />
92+
* Default is {@code false}.
93+
*
94+
* @param partOfIdentity {@code true} if {@code this} property is part of the identity, otherwise {@code false}
95+
* @return {@code this} property
96+
*/
4097
public PackageMaterialProperty withPartOfIdentity(final boolean partOfIdentity) {
4198
this.partOfIdentity = partOfIdentity;
4299
return this;
43100
}
44101

102+
/**
103+
* Sets whether a value is required.
104+
* <p />
105+
* Default is {@code false}.
106+
*
107+
* @param required {@code true} if value is required, otherwise {@code false}
108+
* @return {@code this} property
109+
*/
45110
public PackageMaterialProperty withRequired(final boolean required) {
46111
this.required = required;
47112
return this;
48113
}
49114

115+
/**
116+
* Sets the display name.
117+
*
118+
* @param displayName the display name to set
119+
* @return {@code this} property
120+
*/
50121
public PackageMaterialProperty withDisplayName(final String displayName) {
51122
this.displayName = displayName;
52123
return this;
53124
}
54125

126+
/**
127+
* Sets the display order.
128+
*
129+
* @param displayOrder the display order to set
130+
* @return {@code this} property
131+
*/
55132
public PackageMaterialProperty withDisplayOrder(final int displayOrder) {
56133
this.displayOrder = Integer.toString(displayOrder);
57134
return this;
58135
}
59136

137+
/**
138+
* Sets the default value.
139+
*
140+
* @param defaultValue the default value to set
141+
* @return {@code this} property
142+
*/
60143
public PackageMaterialProperty withDefaultValue(final String defaultValue) {
61144
this.defaultValue = defaultValue;
62145
return this;
63146
}
64147

148+
/**
149+
* Sets the value.
150+
*
151+
* @param value the value to set
152+
* @return {@code this} property
153+
*/
65154
public PackageMaterialProperty withValue(final String value) {
66155
this.value = value;
67156
return this;

0 commit comments

Comments
 (0)