Package com.iizix
Class CircularReferenceFinder<INPUT,TARGET> 
java.lang.Object
com.iizix.CircularReferenceFinder<INPUT,TARGET> 
- Direct Known Subclasses:
- ExtendsCircularReferenceFinder
Helper class to find circular references.
- Author:
- Christopher Mindus
- Constructor SummaryConstructorsConstructorDescription- CircularReferenceFinder- (INPUT input, ICircularReference<INPUT, - TARGET> finder) Constructs the circular reference finder.
- Method SummaryModifier and TypeMethodDescription- intGets the count of chains for all references.- getError()Gets the error message.Gets the first target found.Gets the last target found, it is the same value as the first if just one reference chain exists.- booleanChecks if at least one input caused multiple targets.- protected String- inputToString- (INPUT input) Converts an- inputto a String.- boolean- isValid()Checks if the reference is valid and that it is not circular.- protected String- outputToString- (TARGET target) Converts a- targetto a String.- protected StringThe parameter string.- toString()Converts to a String representation.
- Constructor Details- CircularReferenceFinderConstructs the circular reference finder.- Parameters:
- input- The input reference.
- finder- The finder implementing instance.
 
 
- Method Details- isValidpublic boolean isValid()Checks if the reference is valid and that it is not circular.- Returns:
- true if no error is set, i.e. error is null.
 
- getErrorGets the error message.- Returns:
- Error string for circular finder check, or null for no error.
 
- getFirstTargetGets the first target found.- This target is ONLY set if there was a single target reference found, and is null if there are more than one. - Returns:
- The first target found, or null for none.
 
- getLastTargetGets the last target found, it is the same value as the first if just one reference chain exists. In case of a circular reference error, the last target is the circular reference error cause.- Returns:
- The last target found, or null for none.
 
- getChainCountpublic int getChainCount()Gets the count of chains for all references. This value is an indication to the complexity of the references, and is only really useful if there can be only one reference target per input.- Returns:
- The chain count.
 
- hasMultipleTargetspublic boolean hasMultipleTargets()Checks if at least one input caused multiple targets. If this method returns true, the methods- getFirstTarget(),- getLastTarget()and- getChainCount()should not be used.- Returns:
- true if a problem exists with multiple targets, false otherwise.
 
- inputToStringConverts an- inputto a String.- Override to provide a method for input.toString(). - Parameters:
- input- The input reference.
- Returns:
- The inputString representation, "null" for null input.
 
- outputToStringConverts a- targetto a String.- Override to provide a method for target.toString(). - Parameters:
- target- The target reference (i.e.- getFirstTarget()or- getLastTarget()).
- Returns:
- The targetString representation, "null" for null target.
 
- toStringConverts to a String representation.
- paramStringThe parameter string. Subclasses can override to provide additional parameters, normally appended at the end of the string.- Returns:
- The parameter string.