1 package be
.nikiroo
.jvcard
;
3 import java
.security
.InvalidParameterException
;
4 import java
.util
.LinkedList
;
11 private int b64
; // -1 = no, 0 = still not ordered, the rest is order
12 private List
<TypeInfo
> types
;
13 private boolean dirty
;
14 private Contact parent
;
16 public Data(List
<TypeInfo
> types
, String name
, String value
, String group
) {
18 types
= new LinkedList
<TypeInfo
>();
27 for (TypeInfo type
: types
) {
28 if (type
.getName().equals("ENCODING")
29 && type
.getValue().equals("b")) {
36 public List
<TypeInfo
> getTypes() {
40 public String
getName() {
44 public String
getValue() {
48 public void setValue(String value
) {
49 if ((value
== null && this.value
!= null)
50 || (value
!= null && !value
.equals(this.value
))) {
56 public String
getGroup() {
60 public int getB64Key() {
64 void resetB64Key(int i
) {
66 throw new InvalidParameterException(
67 "Cannot add a BKey on a non-binary object");
69 throw new InvalidParameterException(
70 "Cannot remove the BKey on a binary object");
75 public boolean isBinary() {
79 public boolean isDirty() {
84 * Notify that this element has unsaved changes, and notify its parent of
87 protected void setDirty() {
89 if (this.parent
!= null)
90 this.parent
.setDirty();
94 * Notify this element <i>and all its descendants</i> that it is in pristine
95 * state (as opposed to dirty).
99 for (TypeInfo type
: types
) {
104 void setParent(Contact parent
) {
105 this.parent
= parent
;