Java Code Examples for com.tngtech.archunit.core.domain.JavaClass#isInterface()

The following examples show how to use com.tngtech.archunit.core.domain.JavaClass#isInterface() . 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: PublicAPIRules.java    From ArchUnit with Apache License 2.0 5 votes vote down vote up
private static ArchCondition<? super JavaClass> beInterfaces() {
    return new ArchCondition<JavaClass>("be interfaces") {
        @Override
        public void check(JavaClass item, ConditionEvents events) {
            boolean satisfied = item.isInterface();
            events.add(new SimpleConditionEvent(item, satisfied,
                    String.format("class %s is %sinterface", item.getName(), satisfied ? "" : "no ")));
        }
    };
}
 
Example 2
Source File: ArchConditions.java    From ArchUnit with Apache License 2.0 5 votes vote down vote up
@Override
public void check(JavaClass javaClass, ConditionEvents events) {
    boolean isInterface = javaClass.isInterface();
    String message = createMessage(javaClass,
            (isInterface ? "is an" : "is not an") + " interface");
    events.add(new SimpleConditionEvent(javaClass, isInterface, message));
}
 
Example 3
Source File: RawAccessRecord.java    From ArchUnit with Apache License 2.0 4 votes vote down vote up
public HierarchyResolutionStrategy to(JavaClass parent) {
    return parent.isInterface() ?
            new InterfaceHierarchyResolutionStrategy(child, parent) :
            new ClassHierarchyResolutionStrategy(child, parent);
}