Skip to contentPackage: EntityLoader
EntityLoader
Coverage
1: /**
2: * Copyright (C) 2022 Czech Technical University in Prague
3: * <p>
4: * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
5: * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
6: * version.
7: * <p>
8: * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
9: * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
10: * details. You should have received a copy of the GNU General Public License along with this program. If not, see
11: * <http://www.gnu.org/licenses/>.
12: */
13: package cz.cvut.kbss.jopa.loaders;
14:
15: import cz.cvut.kbss.jopa.model.annotations.OWLClass;
16: import cz.cvut.kbss.jopa.model.annotations.util.NonEntity;
17:
18: import java.util.HashSet;
19: import java.util.Set;
20: import java.util.function.Consumer;
21:
22: /**
23: * Registers entity classes (classes annotated with {@link OWLClass}) discovered during classpath processing.
24: */
25: class EntityLoader implements Consumer<Class<?>> {
26:
27: private final Set<Class<?>> entities = new HashSet<>();
28:
29: public Set<Class<?>> getEntities() {
30: return entities;
31: }
32:
33: @Override
34: public void accept(Class<?> cls) {
35:• if (cls.getAnnotation(OWLClass.class) != null
36:• && cls.getAnnotation(NonEntity.class) == null && !cls.isInterface()) {
37: entities.add(cls);
38: }
39: }
40: }