Java Code Examples for com.tngtech.archunit.core.domain.JavaClass#getConstructors()
The following examples show how to use
com.tngtech.archunit.core.domain.JavaClass#getConstructors() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Module.java From moduliths with Apache License 2.0 | 5 votes |
private static Stream<ModuleDependency> fromConstructorOf(JavaClass source) { Set<JavaConstructor> constructors = source.getConstructors(); return constructors.stream() // .filter(it -> constructors.size() == 1 || isInjectionPoint(it)) // .flatMap(it -> it.getRawParameterTypes().stream() // .map(parameter -> new InjectionModuleDependency(source, parameter, it))); }
Example 2
Source File: PublicAPIRules.java From ArchUnit with Apache License 2.0 | 5 votes |
private static DescribedPredicate<JavaClass> haveAPublicConstructor() { return new DescribedPredicate<JavaClass>("have a public constructor") { @Override public boolean apply(JavaClass input) { for (JavaConstructor constructor : input.getConstructors()) { if (constructor.getModifiers().contains(PUBLIC)) { return true; } } return input.getConstructors().isEmpty() && input.getSuperClass().isPresent() && haveAPublicConstructor().apply(input.getSuperClass().get()); } }; }
Example 3
Source File: RawAccessRecord.java From ArchUnit with Apache License 2.0 | 5 votes |
@Override protected boolean signatureExistsIn(JavaClass javaClass) { for (JavaConstructor constructor : javaClass.getConstructors()) { if (hasMatchingSignatureTo(constructor)) { return true; } } return false; }