Skip to content

Commit 63ac758

Browse files
committed
feat: create value writer
Signed-off-by: Otavio Santana <[email protected]>
1 parent d115f0d commit 63ac758

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed
Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,38 @@
1-
package org.eclipse.jnosql.databases.mongodb.communication;public class UUIDValueWriter {
1+
/*
2+
* Copyright (c) 2024 Contributors to the Eclipse Foundation
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* and Apache License v2.0 which accompanies this distribution.
6+
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7+
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
8+
*
9+
* You may elect to redistribute this code under either of these licenses.
10+
*
11+
* Contributors:
12+
*
13+
* Otavio Santana
14+
*/
15+
package org.eclipse.jnosql.databases.mongodb.communication;
16+
17+
import org.eclipse.jnosql.communication.ValueWriter;
18+
19+
import java.util.Objects;
20+
import java.util.UUID;
21+
22+
public class UUIDValueWriter implements ValueWriter<UUID, String> {
23+
24+
@Override
25+
public boolean test(Class<?> type) {
26+
return UUID.class.equals(type);
27+
}
28+
29+
30+
@Override
31+
public String write(UUID uuid) {
32+
if(Objects.nonNull(uuid)) {
33+
return uuid.toString();
34+
}
35+
return null;
36+
}
37+
238
}

0 commit comments

Comments
 (0)