Skip to content

Commit bebad3c

Browse files
committed
JAXB Value marshal and unmarshal now working with custom Value implementation
1 parent a0b7545 commit bebad3c

21 files changed

+99
-20
lines changed

KDBX.4.xsd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,12 @@
321321
</xs:simpleType>
322322

323323
<xs:complexType name="ValueExtender" abstract="true">
324+
<xs:annotation>
325+
<xs:documentation>Abstract parent for StringField/Value so that
326+
to allow creation of a custom mapping that contains extra
327+
non-serialised (transient) fields.
328+
</xs:documentation>
329+
</xs:annotation>
324330
<xs:simpleContent>
325331
<xs:extension base="xs:string"/>
326332
</xs:simpleContent>
@@ -409,6 +415,8 @@
409415
<xs:complexType>
410416
<xs:sequence>
411417
<xs:element name="UUID" type="uuid"/>
418+
<xs:element name="Name" type="xs:string"/>
419+
<xs:element name="LastModificationTime" type="keepassDateTime" />
412420
<xs:element name="Data" type="xs:base64Binary"/>
413421
</xs:sequence>
414422
</xs:complexType>

jaxb/bindings.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
/>
4040
</bindings>
4141

42-
4342
<bindings node = "//xs:complexType[@name='ValueExtender']">
4443
<class implClass="org.linguafranca.pwdb.kdbx.jaxb.base.ValueBinding"/>
4544
</bindings>

jaxb/src/generated/java/org/linguafranca/pwdb/kdbx/jaxb/binding/Adapter1.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
33
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
44
// Any modifications to this file will be lost upon recompilation of the source schema.
5-
// Generated on: 2023.05.16 at 04:44:10 PM BST
5+
// Generated on: 2023.05.17 at 11:23:19 AM BST
66
//
77

88

jaxb/src/generated/java/org/linguafranca/pwdb/kdbx/jaxb/binding/Adapter2.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
33
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
44
// Any modifications to this file will be lost upon recompilation of the source schema.
5-
// Generated on: 2023.05.16 at 04:44:10 PM BST
5+
// Generated on: 2023.05.17 at 11:23:19 AM BST
66
//
77

88

jaxb/src/generated/java/org/linguafranca/pwdb/kdbx/jaxb/binding/Adapter3.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
33
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
44
// Any modifications to this file will be lost upon recompilation of the source schema.
5-
// Generated on: 2023.05.16 at 04:44:10 PM BST
5+
// Generated on: 2023.05.17 at 11:23:19 AM BST
66
//
77

88

jaxb/src/generated/java/org/linguafranca/pwdb/kdbx/jaxb/binding/AutoType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
33
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
44
// Any modifications to this file will be lost upon recompilation of the source schema.
5-
// Generated on: 2023.05.16 at 04:44:10 PM BST
5+
// Generated on: 2023.05.17 at 11:23:19 AM BST
66
//
77

88

jaxb/src/generated/java/org/linguafranca/pwdb/kdbx/jaxb/binding/Binaries.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
33
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
44
// Any modifications to this file will be lost upon recompilation of the source schema.
5-
// Generated on: 2023.05.16 at 04:44:10 PM BST
5+
// Generated on: 2023.05.17 at 11:23:19 AM BST
66
//
77

88

jaxb/src/generated/java/org/linguafranca/pwdb/kdbx/jaxb/binding/BinaryField.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
33
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
44
// Any modifications to this file will be lost upon recompilation of the source schema.
5-
// Generated on: 2023.05.16 at 04:44:10 PM BST
5+
// Generated on: 2023.05.17 at 11:23:19 AM BST
66
//
77

88

jaxb/src/generated/java/org/linguafranca/pwdb/kdbx/jaxb/binding/CustomData.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
33
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
44
// Any modifications to this file will be lost upon recompilation of the source schema.
5-
// Generated on: 2023.05.16 at 04:44:10 PM BST
5+
// Generated on: 2023.05.17 at 11:23:19 AM BST
66
//
77

88

jaxb/src/generated/java/org/linguafranca/pwdb/kdbx/jaxb/binding/CustomIcons.java

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
33
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
44
// Any modifications to this file will be lost upon recompilation of the source schema.
5-
// Generated on: 2023.05.16 at 04:44:10 PM BST
5+
// Generated on: 2023.05.17 at 11:23:19 AM BST
66
//
77

88

99
package org.linguafranca.pwdb.kdbx.jaxb.binding;
1010

1111
import java.util.ArrayList;
12+
import java.util.Date;
1213
import java.util.List;
1314
import java.util.UUID;
1415
import javax.xml.bind.annotation.XmlAccessType;
@@ -35,6 +36,8 @@
3536
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
3637
* &lt;sequence>
3738
* &lt;element name="UUID" type="{}uuid"/>
39+
* &lt;element name="Name" type="{http://www.w3.org/2001/XMLSchema}string"/>
40+
* &lt;element name="LastModificationTime" type="{}keepassDateTime"/>
3841
* &lt;element name="Data" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/>
3942
* &lt;/sequence>
4043
* &lt;/restriction>
@@ -99,6 +102,8 @@ public List<CustomIcons.Icon> getIcon() {
99102
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
100103
* &lt;sequence>
101104
* &lt;element name="UUID" type="{}uuid"/>
105+
* &lt;element name="Name" type="{http://www.w3.org/2001/XMLSchema}string"/>
106+
* &lt;element name="LastModificationTime" type="{}keepassDateTime"/>
102107
* &lt;element name="Data" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/>
103108
* &lt;/sequence>
104109
* &lt;/restriction>
@@ -111,6 +116,8 @@ public List<CustomIcons.Icon> getIcon() {
111116
@XmlAccessorType(XmlAccessType.FIELD)
112117
@XmlType(name = "", propOrder = {
113118
"uuid",
119+
"name",
120+
"lastModificationTime",
114121
"data"
115122
})
116123
public static class Icon {
@@ -119,6 +126,12 @@ public static class Icon {
119126
@XmlJavaTypeAdapter(Adapter3 .class)
120127
@XmlSchemaType(name = "base64Binary")
121128
protected UUID uuid;
129+
@XmlElement(name = "Name", required = true)
130+
protected String name;
131+
@XmlElement(name = "LastModificationTime", required = true, type = String.class)
132+
@XmlJavaTypeAdapter(Adapter1 .class)
133+
@XmlSchemaType(name = "dateTime")
134+
protected Date lastModificationTime;
122135
@XmlElement(name = "Data", required = true)
123136
protected byte[] data;
124137

@@ -146,6 +159,54 @@ public void setUUID(UUID value) {
146159
this.uuid = value;
147160
}
148161

162+
/**
163+
* Gets the value of the name property.
164+
*
165+
* @return
166+
* possible object is
167+
* {@link String }
168+
*
169+
*/
170+
public String getName() {
171+
return name;
172+
}
173+
174+
/**
175+
* Sets the value of the name property.
176+
*
177+
* @param value
178+
* allowed object is
179+
* {@link String }
180+
*
181+
*/
182+
public void setName(String value) {
183+
this.name = value;
184+
}
185+
186+
/**
187+
* Gets the value of the lastModificationTime property.
188+
*
189+
* @return
190+
* possible object is
191+
* {@link String }
192+
*
193+
*/
194+
public Date getLastModificationTime() {
195+
return lastModificationTime;
196+
}
197+
198+
/**
199+
* Sets the value of the lastModificationTime property.
200+
*
201+
* @param value
202+
* allowed object is
203+
* {@link String }
204+
*
205+
*/
206+
public void setLastModificationTime(Date value) {
207+
this.lastModificationTime = value;
208+
}
209+
149210
/**
150211
* Gets the value of the data property.
151212
*

jaxb/src/generated/java/org/linguafranca/pwdb/kdbx/jaxb/binding/History.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
33
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
44
// Any modifications to this file will be lost upon recompilation of the source schema.
5-
// Generated on: 2023.05.16 at 04:44:10 PM BST
5+
// Generated on: 2023.05.17 at 11:23:19 AM BST
66
//
77

88

jaxb/src/generated/java/org/linguafranca/pwdb/kdbx/jaxb/binding/JaxbEntryBinding.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
33
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
44
// Any modifications to this file will be lost upon recompilation of the source schema.
5-
// Generated on: 2023.05.16 at 04:44:10 PM BST
5+
// Generated on: 2023.05.17 at 11:23:19 AM BST
66
//
77

88

jaxb/src/generated/java/org/linguafranca/pwdb/kdbx/jaxb/binding/JaxbGroupBinding.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
33
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
44
// Any modifications to this file will be lost upon recompilation of the source schema.
5-
// Generated on: 2023.05.16 at 04:44:10 PM BST
5+
// Generated on: 2023.05.17 at 11:23:19 AM BST
66
//
77

88

jaxb/src/generated/java/org/linguafranca/pwdb/kdbx/jaxb/binding/KeePassFile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
33
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
44
// Any modifications to this file will be lost upon recompilation of the source schema.
5-
// Generated on: 2023.05.16 at 04:44:10 PM BST
5+
// Generated on: 2023.05.17 at 11:23:19 AM BST
66
//
77

88

jaxb/src/generated/java/org/linguafranca/pwdb/kdbx/jaxb/binding/ObjectFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
33
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
44
// Any modifications to this file will be lost upon recompilation of the source schema.
5-
// Generated on: 2023.05.16 at 04:44:10 PM BST
5+
// Generated on: 2023.05.17 at 11:23:19 AM BST
66
//
77

88

jaxb/src/generated/java/org/linguafranca/pwdb/kdbx/jaxb/binding/Parented.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
33
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
44
// Any modifications to this file will be lost upon recompilation of the source schema.
5-
// Generated on: 2023.05.16 at 04:44:10 PM BST
5+
// Generated on: 2023.05.17 at 11:23:19 AM BST
66
//
77

88

jaxb/src/generated/java/org/linguafranca/pwdb/kdbx/jaxb/binding/StringField.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
33
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
44
// Any modifications to this file will be lost upon recompilation of the source schema.
5-
// Generated on: 2023.05.16 at 04:44:10 PM BST
5+
// Generated on: 2023.05.17 at 11:23:19 AM BST
66
//
77

88

jaxb/src/generated/java/org/linguafranca/pwdb/kdbx/jaxb/binding/Times.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
33
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
44
// Any modifications to this file will be lost upon recompilation of the source schema.
5-
// Generated on: 2023.05.16 at 04:44:10 PM BST
5+
// Generated on: 2023.05.17 at 11:23:19 AM BST
66
//
77

88

jaxb/src/generated/java/org/linguafranca/pwdb/kdbx/jaxb/binding/ValueExtender.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
33
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
44
// Any modifications to this file will be lost upon recompilation of the source schema.
5-
// Generated on: 2023.05.16 at 04:44:10 PM BST
5+
// Generated on: 2023.05.17 at 11:23:19 AM BST
66
//
77

88

@@ -16,6 +16,11 @@
1616

1717

1818
/**
19+
* Abstract parent for StringField/Value so that
20+
* to allow creation of a custom mapping that contains extra
21+
* non-serialised (transient) fields.
22+
*
23+
*
1924
* <p>Java class for ValueExtender complex type.
2025
*
2126
* <p>The following schema fragment specifies the expected content contained within this class.

jaxb/src/main/java/org/linguafranca/pwdb/kdbx/jaxb/base/ValueBinding.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
package org.linguafranca.pwdb.kdbx.jaxb.base;
22

3+
import javax.xml.bind.annotation.XmlAccessType;
4+
import javax.xml.bind.annotation.XmlAccessorType;
35
import javax.xml.bind.annotation.XmlTransient;
46
import javax.xml.bind.annotation.XmlValue;
57

68
/**
7-
* providing a way of flagging protection
9+
* Ancestor class of StringField.Value, providing a way of flagging protection
10+
* separate from @Protected and @ProtectInMemory
811
*/
12+
@XmlAccessorType(XmlAccessType.FIELD)
913
public abstract class ValueBinding {
1014

1115
@XmlTransient
1216
public boolean protectOnOutput;
1317

14-
protected String value;
18+
@XmlValue
19+
public String value;
1520

1621
public String getValue(){
1722
return value;

jaxb/src/main/java/org/linguafranca/pwdb/kdbx/jaxb/util/DateAdapter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public static String toString(Date date) {
3030
}
3131

3232
public static Date fromString(String string) {
33+
// this is found in the base template
3334
if (string.equals("${creationDate}")) {
3435
return new Date();
3536
}

0 commit comments

Comments
 (0)