Exemple #1
0
 public static boolean validSourceAndTarget(
     final Object source, final Object target, final TransformationConfig config) {
   final Model sourceModel = source instanceof Model ? (Model) source : null;
   final Model targetModel = target instanceof Model ? (Model) target : null;
   if (sourceModel != null && Util.type(sourceModel)) {
     return false;
   }
   if (targetModel != null && Util.type(targetModel)) {
     return false;
   }
   if (sourceModel != null && targetModel != null) {
     if (config.getMapping(sourceModel, targetModel) != null) {
       return false;
     }
     if (sourceModel.isCollection() && targetModel.isCollection()) {
       return false;
     }
   }
   return true;
 }
Exemple #2
0
 public static boolean type(final Model model) {
   return (!model.isCollection() && !model.getChildren().isEmpty());
 }
Exemple #3
0
 public static boolean isOrInCollection(final Model model) {
   return model != null && (model.isCollection() || isOrInCollection(model.getParent()));
 }