• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

burningwave / reflection / #68

18 Oct 2023 11:19AM UTC coverage: 74.528% (+5.4%) from 69.107%
#68

push

Roberto-Gentili
Bug fix

790 of 1060 relevant lines covered (74.53%)

0.75 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.0
/src/main/java/org/burningwave/reflection/ConstructorCriteria.java
1
/*
2
 * This file is part of Burningwave Reflection.
3
 *
4
 * Author: Roberto Gentili
5
 *
6
 * Hosted at: https://github.com/burningwave/reflection
7
 *
8
 * --
9
 *
10
 * The MIT License (MIT)
11
 *
12
 * Copyright (c) 2022 Roberto Gentili
13
 *
14
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
15
 * documentation files (the "Software"), to deal in the Software without restriction, including without
16
 * limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
17
 * the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
18
 * conditions:
19
 *
20
 * The above copyright notice and this permission notice shall be included in all copies or substantial
21
 * portions of the Software.
22
 *
23
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24
 * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
25
 * EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
26
 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
27
 * OR OTHER DEALINGS IN THE SOFTWARE.
28
 */
29
package org.burningwave.reflection;
30

31
import java.lang.reflect.Constructor;
32
import java.util.function.BiPredicate;
33
import java.util.function.Function;
34

35
public class ConstructorCriteria extends ExecutableMemberCriteria<
36
        Constructor<?>, ConstructorCriteria, Criteria.TestContext<Constructor<?>, ConstructorCriteria>
37
> {
38
        private ConstructorCriteria() {
39
                super();
1✔
40
        }
1✔
41

42
        public static ConstructorCriteria byScanUpTo(BiPredicate<Class<?>, Class<?>> predicate) {
43
                return new ConstructorCriteria().scanUpTo(predicate);
1✔
44
        }
45

46
        public static ConstructorCriteria forEntireClassHierarchy() {
47
                return new ConstructorCriteria();
×
48
        }
49

50
        public static ConstructorCriteria withoutConsideringParentClasses() {
51
                return byScanUpTo((lastClassInHierarchy, currentScannedClass) -> {
1✔
52
            return lastClassInHierarchy.equals(currentScannedClass);
1✔
53
        });
54
        }
55

56
        @Override
57
        Function<Class<?>, Constructor<?>[]> getMembersSupplierFunction() {
58
                return clazz -> {
1✔
59
                        return Cache.INSTANCE.uniqueKeyForConstructorsArray.getOrUploadIfAbsent(
1✔
60
                                Constructors.INSTANCE.getCacheKey(clazz, Members.ALL_FOR_CLASS), () -> {
1✔
61
                                        return Facade.INSTANCE.getDeclaredConstructors(clazz);
1✔
62
                                }
63
                        );
64
                };
65
        }
66

67
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc