Build the list of decoder entries from a set of decoder implementations. @param decoderClazzes Decoder implementation classes @param instanceManager Instance manager to use to create Decoder instances @return List of mappings from target type to associated decoder @throws DeploymentException If
(List<Class<? extends Decoder>> decoderClazzes,
InstanceManager instanceManager)
| 333 | * @throws DeploymentException If a provided decoder class is not valid |
| 334 | */ |
| 335 | public static List<DecoderEntry> getDecoders(List<Class<? extends Decoder>> decoderClazzes, |
| 336 | InstanceManager instanceManager) throws DeploymentException { |
| 337 | |
| 338 | List<DecoderEntry> result = new ArrayList<>(); |
| 339 | if (decoderClazzes != null) { |
| 340 | for (Class<? extends Decoder> decoderClazz : decoderClazzes) { |
| 341 | // Need to instantiate decoder to ensure it is valid and that |
| 342 | // deployment can be failed if it is not |
| 343 | Decoder instance; |
| 344 | try { |
| 345 | if (instanceManager == null) { |
| 346 | instance = decoderClazz.getConstructor().newInstance(); |
| 347 | } else { |
| 348 | instance = (Decoder) instanceManager.newInstance(decoderClazz); |
| 349 | // Don't need this instance, so destroy it |
| 350 | instanceManager.destroyInstance(instance); |
| 351 | } |
| 352 | } catch (ReflectiveOperationException | IllegalArgumentException | SecurityException | |
| 353 | NamingException e) { |
| 354 | throw new DeploymentException( |
| 355 | sm.getString("pojoMethodMapping.invalidDecoder", decoderClazz.getName()), e); |
| 356 | } |
| 357 | DecoderEntry entry = new DecoderEntry(getDecoderType(decoderClazz), decoderClazz); |
| 358 | result.add(entry); |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | return result; |
| 363 | } |
| 364 | |
| 365 | |
| 366 | static Set<MessageHandlerResult> getMessageHandlers(Class<?> target, MessageHandler listener, |
no test coverage detected