Skip to content

Package: StorableIdFactory

StorableIdFactory

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.service.storable.model.id;
14:
15: import org.eclipse.kapua.model.KapuaObjectFactory;
16:
17: /**
18: * {@link StorableIdFactory} definition.
19: * <p>
20: * It is the {@link KapuaObjectFactory} for {@link StorableId}s.
21: *
22: * @since 1.0.0
23: */
24: public interface StorableIdFactory extends KapuaObjectFactory {
25:
26: /**
27: * Creates a new {@link StorableId} starting the provided string identifier.<br>
28: * <b>This operation must be the inverse function of {@link StorableId#toString()} so, in other word, this code should't fail:
29: * </b>
30: *
31: * <pre>
32: * {@code
33: * StorableIdFactory storableIdFactory = KapuaLocator.getInstance().getService(StorableIdFactory.class);<br>
34: * String shortId = "some well formed encoded short id";
35: * StorableId id = storableIdFactory.newStorableId(shortId);
36: * String shortIdConverted = id.getShortId();
37: * AssertTrue(shortId.equals(shortIdConverted));
38: * }
39: * </pre>
40: *
41: * @param stringId The {@link StorableId} short id to parse.
42: * @return The {@link StorableId} parsed from its short representation.
43: * @since 1.0.0
44: */
45: StorableId newStorableId(String stringId);
46:
47: }