Skip to content

Package: KapuaEntityFactory

KapuaEntityFactory

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.model;
14:
15: import org.eclipse.kapua.KapuaEntityCloneException;
16: import org.eclipse.kapua.model.id.KapuaId;
17: import org.eclipse.kapua.model.query.KapuaListResult;
18: import org.eclipse.kapua.model.query.KapuaQuery;
19:
20: /**
21: * {@link KapuaEntityFactory} definition.
22: *
23: * @param <E> The {@link KapuaEntity} for which this {@link KapuaEntityFactory} is for.
24: * @param <C> The {@link KapuaEntityCreator} for which this {@link KapuaEntityFactory} is for.
25: * @param <Q> The {@link KapuaQuery} for which this {@link KapuaEntityFactory} is for.
26: * @param <L> The {@link KapuaListResult} for which this {@link KapuaEntityFactory} is for.
27: * @since 1.0.0
28: */
29: public interface KapuaEntityFactory<E extends KapuaEntity, C extends KapuaEntityCreator<E>, Q extends KapuaQuery, L extends KapuaListResult<E>> extends KapuaObjectFactory {
30:
31: /**
32: * Instantiates a new {@link KapuaEntity}.
33: *
34: * @param scopeId The scope {@link KapuaId} to be set in the {@link KapuaEntity}
35: * @return The newly instantiated {@link KapuaEntity}
36: * @since 1.0.0
37: */
38: E newEntity(KapuaId scopeId);
39:
40: /**
41: * Instantiates a new {@link KapuaEntityCreator}.
42: *
43: * @param scopeId The scope {@link KapuaId} to be set in the {@link KapuaEntityCreator}
44: * @return The newly instantiated {@link KapuaEntityCreator}
45: * @since 1.0.0
46: */
47: C newCreator(KapuaId scopeId);
48:
49: /**
50: * Instantiates a new {@link KapuaQuery}.
51: *
52: * @param scopeId The scope {@link KapuaId} to be set in the {@link KapuaQuery}
53: * @return The newly instantiated {@link KapuaQuery}
54: * @since 1.0.0
55: */
56: Q newQuery(KapuaId scopeId);
57:
58: /**
59: * Instantiates a new {@link KapuaListResult}.
60: *
61: * @return The newly instantiated {@link KapuaListResult}
62: * @since 1.0.0
63: */
64: L newListResult();
65:
66: /**
67: * Deeply clones the given {@link KapuaEntity}.
68: *
69: * @param entity The {@link KapuaEntity} to be cloned.
70: * @return A deep clone of the {@link KapuaEntity}
71: * @throws KapuaEntityCloneException When error occurs while cloning the {@link KapuaEntity}
72: * @since 1.1.0
73: */
74: E clone(E entity) throws KapuaEntityCloneException;
75: }