Package com.codiform.moo

Examples of com.codiform.moo.TranslationException


   */
  public T create() {
    try {
      return destinationClass.newInstance();
    } catch (InstantiationException exception) {
      throw new TranslationException(String.format(
          "Error while instantiating %s", destinationClass),
          exception);
    } catch (IllegalAccessException exception) {
      throw new TranslationException(String.format(
          "Not allowed to instantiate %s", destinationClass),
          exception);
    }
  }
View Full Code Here


      TranslationSource translationSource) {
    if (value == null) {
      return null;
    } else if (value instanceof Collection) {
      if (property.shouldBeTranslated()) {
        throw new TranslationException(
            "Cannot use @Translate on a collection (cannot determine internal type due to erasure); use @TranslateCollection instead.");
      }
      return transformCollection(value, property, translationSource);
    } else if (value.getClass().isArray()) {
      return transformArray((Object[]) value, property, translationSource);
View Full Code Here

      } else {
        return configuration.getArrayTranslator().translate(value,
            fieldType.getComponentType(), translationSource);
      }
    } else {
      throw new TranslationException(
          String
              .format(
                  "Cannot translate from source array type %s[] to destination type %s",
                  valueType.getComponentType(), fieldType
                      .getName()));
View Full Code Here

      value = transform(value, property, translationSource);
      property.setValue(destination, value);
      return true;
    } catch (PropertyAccessException exception) {
      if (configuration.isSourcePropertyRequired()) {
        throw new TranslationException(
            "Could not find required source property for expression: "
                + property.getTranslationExpression(),
            exception);
      }
      return false;
View Full Code Here

  private Map copyMap(Map value, TranslateCollection annotation) {
    if (annotation == null) {
      return configuration.isPerformingDefensiveCopies() ? new HashMap(
          value) : value;
    } else {
      throw new TranslationException(
          "Support for translated maps not yet built.");
    }
  }
View Full Code Here

        return map;
      } else {
        return value;
      }
    } else {
      throw new TranslationException(
          "Support for translated sorted maps not yet built");
    }
  }
View Full Code Here

        return result;
      } else {
        return value;
      }
    } else {
      throw new TranslationException(
          "Support for translated sorted sets not yet built");
    }
  }
View Full Code Here

   */
  public T create() {
    try {
      return destinationClass.newInstance();
    } catch (InstantiationException exception) {
      throw new TranslationException(String.format(
          "Error while instantiating %s", destinationClass),
          exception);
    } catch (IllegalAccessException exception) {
      throw new TranslationException(String.format(
          "Not allowed to instantiate %s", destinationClass),
          exception);
    }
  }
View Full Code Here

      TranslationSource translationSource) {
    if (value == null) {
      return null;
    } else if (value instanceof Collection) {
      if (property.shouldBeTranslated()) {
        throw new TranslationException(
            "Cannot use @Translate on a collection (cannot determine internal type due to erasure); use @TranslateCollection instead.");
      }
      return transformCollection(value, property, translationSource);
    } else if (value.getClass().isArray()) {
      return transformArray((Object[]) value, property, translationSource);
View Full Code Here

      } else {
        return configuration.getArrayTranslator().translate(value,
            fieldType.getComponentType(), translationSource);
      }
    } else {
      throw new TranslationException(
          String
              .format(
                  "Cannot translate from source array type %s[] to destination type %s",
                  valueType.getComponentType(), fieldType
                      .getName()));
View Full Code Here

TOP

Related Classes of com.codiform.moo.TranslationException

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.