Package com.tngtech.archunit.lang
Class ConditionEvents
- java.lang.Object
-
- com.tngtech.archunit.lang.ConditionEvents
-
- All Implemented Interfaces:
java.lang.Iterable<ConditionEvent>
public final class ConditionEvents extends java.lang.Object implements java.lang.Iterable<ConditionEvent>
-
-
Constructor Summary
Constructors Constructor Description ConditionEvents()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
add(ConditionEvent event)
boolean
containViolation()
java.util.Collection<ConditionEvent>
getAllowed()
java.util.List<java.lang.String>
getFailureDescriptionLines()
Deprecated.UsegetFailureMessages()
insteadFailureMessages
getFailureMessages()
java.util.Collection<ConditionEvent>
getViolating()
void
handleViolations(ViolationHandler<?> violationHandler)
Passes violations to the suppliedViolationHandler
.boolean
isEmpty()
java.util.Iterator<ConditionEvent>
iterator()
void
setInformationAboutNumberOfViolations(java.lang.String informationAboutNumberOfViolations)
Can be used to override the information about the number of violations.java.lang.String
toString()
-
-
-
Constructor Detail
-
ConditionEvents
@PublicAPI(usage=ACCESS) public ConditionEvents()
-
-
Method Detail
-
add
@PublicAPI(usage=ACCESS) public void add(ConditionEvent event)
-
setInformationAboutNumberOfViolations
@PublicAPI(usage=ACCESS) public void setInformationAboutNumberOfViolations(java.lang.String informationAboutNumberOfViolations)
Can be used to override the information about the number of violations. If absent the violated rule will simply report the number of violation lines as the number of violations (which is typically correct, since ArchUnit usually reports one violation per line). However in cases where violations are omitted (e.g. because a limit of reported violations is configured), this information can be supplied here to inform users there there actually were more violations than reported.- Parameters:
informationAboutNumberOfViolations
- The text to be shown for the number of times a rule has been violated
-
getViolating
@PublicAPI(usage=ACCESS) public java.util.Collection<ConditionEvent> getViolating()
-
getAllowed
@PublicAPI(usage=ACCESS) public java.util.Collection<ConditionEvent> getAllowed()
-
containViolation
@PublicAPI(usage=ACCESS) public boolean containViolation()
-
isEmpty
@PublicAPI(usage=ACCESS) public boolean isEmpty()
-
getFailureDescriptionLines
@Deprecated @PublicAPI(usage=ACCESS) public java.util.List<java.lang.String> getFailureDescriptionLines()
Deprecated.UsegetFailureMessages()
instead- Returns:
- List of text lines describing the contained failures of these events.
-
getFailureMessages
@PublicAPI(usage=ACCESS) public FailureMessages getFailureMessages()
- Returns:
- Sorted failure messages describing the contained failures of these events. Also offers information about the number of violations contained in these events.
-
handleViolations
@PublicAPI(usage=ACCESS, state=EXPERIMENTAL) public void handleViolations(ViolationHandler<?> violationHandler)
Passes violations to the suppliedViolationHandler
. The passed violations will automatically be filtered by the reified type of the givenViolationHandler
. That is, if aViolationHandler<SomeClass>
is passed, only violations by objects assignable toSomeClass
will be reported. The term 'reified' means that the type parameter was not erased, i.e. ArchUnit can still determine the actual type parameter of the passed violation handler, otherwise the upper bound, in extreme casesObject
, will be used (i.e. all violations will be passed).- Parameters:
violationHandler
- The violation handler that is supposed to handle all violations matching the respective type parameter
-
iterator
@PublicAPI(usage=ACCESS) public java.util.Iterator<ConditionEvent> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<ConditionEvent>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-