Skip to content

Commit 28310e9

Browse files
Add attributes (#328)
1 parent 1a6da05 commit 28310e9

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed
Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,36 @@
11
package com.contentful.java.cda;
22

3+
import com.google.gson.annotations.SerializedName;
4+
5+
import java.util.Map;
36

47
public class CDATaxonomyConcept extends CDAResource {
8+
private static final long serialVersionUID = -2852530837647669036L;
9+
10+
@SerializedName("prefLabel")
11+
protected Map<String, String> prefLabel;
12+
13+
/**
14+
* @return the preferred label map containing locale-to-label mappings.
15+
*/
16+
public Map<String, String> prefLabel() {
17+
return prefLabel;
18+
}
19+
20+
/**
21+
* Get the preferred label for a specific locale.
22+
* @param locale the locale code (e.g., "en-US")
23+
* @return the label for the specified locale, or null if not found
24+
*/
25+
public String getPrefLabel(String locale) {
26+
return prefLabel != null ? prefLabel.get(locale) : null;
27+
}
28+
529
@Override
630
public String toString() {
731
return "CDATaxonomyConcept{"
8-
+ "attrs=" + attrs
32+
+ "attrs=" + attrs + '\''
33+
+ ", prefLabel=" + prefLabel
934
+ '}';
1035
}
1136
}

0 commit comments

Comments
 (0)