-
Notifications
You must be signed in to change notification settings - Fork 37
/
QualifiedIIdMapKeyDeserializer.java
32 lines (27 loc) · 1.27 KB
/
QualifiedIIdMapKeyDeserializer.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
* Copyright (c) 2010-2023 BSI Business Systems Integration AG.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* BSI Business Systems Integration AG - initial API and implementation
*/
package org.eclipse.scout.rt.jackson.dataobject.id;
import org.eclipse.scout.rt.dataobject.id.IId;
import org.eclipse.scout.rt.dataobject.id.IdExternalFormatter;
import org.eclipse.scout.rt.platform.util.LazyValue;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.KeyDeserializer;
/**
* Custom deserializer for {@link IId} instances - like {@link TypedIdDeserializer} it uses {@link IdExternalFormatter}
* for serialization. It may be used as a replacement for {@link IIdDeserializer}.
*/
public class QualifiedIIdMapKeyDeserializer extends KeyDeserializer {
protected final LazyValue<IdExternalFormatter> m_idExternalFormatter = new LazyValue<>(IdExternalFormatter.class);
@Override
public Object deserializeKey(String key, DeserializationContext ctxt) {
return m_idExternalFormatter.get().fromExternalForm(key);
}
}