public void registerCandidate ( Class < ? > candidateClass , String description , Candidate . CandidateType type ) { Candidate candidate = new Candidate ( candidateClass , description , type ) ; int index = candidates . indexOf ( candidate ) ; if ( index >= 0 ) { Candidate existingCandidate = candidates . get ( index ) ; if ( ! description . equals ( existingCandidate . getDescription ( ) ) ) { throw new IllegalStateException ( "Two different descriptions for candidate " + candidateClass . getName ( ) ) ; } existingCandidate . getTypes ( ) . add ( type ) ; } else { candidates . add ( candidate ) ; } }
Register a candidate class to attempt to instantiate .