Package com.codiform.moo.translator

Examples of com.codiform.moo.translator.TranslationTargetFactory


    }
  }

  private <T> T getObjectTranslation( Object source, Class<? extends TranslationTargetFactory> factoryType, Class<T> destinationClass ) {
    ObjectTranslator<T> translator = getTranslator( destinationClass );
    TranslationTargetFactory factory = getTranslationTargetFactory( factoryType );
    T translated = factory.getTranslationTargetInstance( source, destinationClass );
    if ( translated == null )
      throw new TranslationException( "Translation target factory (" + factory + ") returned null instance; cannot translate." );
    translationCache.putTranslation( source, translated );
    translator.update( source, translated, this, variables );
    return translated;
View Full Code Here


  public TranslationTargetFactory getTranslationTargetFactory( Class<? extends TranslationTargetFactory> factoryType ) {
    if ( translationTargetFactoryCache.containsKey( factoryType ) )
      return translationTargetFactoryCache.get( factoryType );
    else {
      try {
        TranslationTargetFactory instance = factoryType.newInstance();
        translationTargetFactoryCache.put( factoryType, instance );
        return instance;
      } catch ( InstantiationException cause ) {
        throw new TranslationException( "Could not create translation target factory: " + factoryType, cause );
      } catch ( IllegalAccessException cause ) {
View Full Code Here

TOP

Related Classes of com.codiform.moo.translator.TranslationTargetFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.