protected <T> T executeCommand( Command cmd ) { if( AcceptedClientCommands.isSendObjectParameterCommandClass(cmd.getClass()) ) { List<Object> extraClassInstanceList = new ArrayList<Object>(); preprocessParameterCommand(cmd, extraClassInstanceList); if( !extraClassInstanceList.isEmpty() ) { Set<Class<?>> extraJaxbClasses = new HashSet<Class<?>>(); for( Object jaxbObject : extraClassInstanceList ) { Class<?> jaxbClass = jaxbObject.getClass(); if( jaxbClass.isLocalClass() || jaxbClass.isAnonymousClass() ) { throw new SerializationException( "Only proper classes are allowed as parameters for the remote API: neither local nor anonymous classes are accepted: " + jaxbClass.getName()); } extraJaxbClasses.add(jaxbClass); } if( config.addJaxbClasses(extraJaxbClasses) ) { for( Class<?> extraClass : extraJaxbClasses ) { logger.debug( "Adding {} to the JAXBContext instance in this client instance.", extraClass.getName() ); } config.initializeJaxbSerializationProvider(); } } } preprocessCommand(cmd); if( config.isRest() ) { return executeRestCommand(cmd); } else { return executeJmsCommand(cmd); } }