예제 #1
0
 private static RefChainResult processRefChains(final ObjectSpecification o) {
   if (countRefPathsInObjectSpec(o) > 1) {
     throw new IllegalArgumentException(
         "Only one of the 6 options " + "for specifying an object reference path is allowed");
   }
   if (o.getObjPath() != null && !o.getObjPath().isEmpty()) {
     return new RefChainResult(processObjectPath(o.getObjPath(), false), false);
   } else if (o.getToObjPath() != null && !o.getToObjPath().isEmpty()) {
     return new RefChainResult(processObjectPath(o.getToObjPath(), true), true);
   }
   if (o.getObjRefPath() != null && !o.getObjRefPath().isEmpty()) {
     return new RefChainResult(processRefPath(o.getObjRefPath(), false), false);
   } else if (o.getToObjRefPath() != null && !o.getToObjRefPath().isEmpty()) {
     return new RefChainResult(processRefPath(o.getToObjRefPath(), true), true);
   }
   return null;
 }
예제 #2
0
 private static int countRefPathsInObjectSpec(final ObjectSpecification o) {
   int count = 0;
   // there's probably some obnoxiously smarter way to do this
   if (o.getObjPath() != null && !o.getObjPath().isEmpty()) {
     count++;
   }
   if (o.getObjRefPath() != null && !o.getObjRefPath().isEmpty()) {
     count++;
   }
   if (o.getToObjPath() != null && !o.getToObjPath().isEmpty()) {
     count++;
   }
   if (o.getToObjRefPath() != null && !o.getToObjRefPath().isEmpty()) {
     count++;
   }
   if (longToBoolean(o.getFindReferencePath())) {
     count++;
   }
   return count;
 }