コード例 #1
0
 @Override
 protected ParseResult parseTokenWithSeparator(
     LoadContext context, FactSetDefinition def, String value) {
   StringTokenizer aTok = new StringTokenizer(value, Constants.PIPE);
   String fileType = aTok.nextToken();
   if (!aTok.hasMoreTokens()) {
     return new ParseResult.Fail(
         getTokenName() + " expects 2 PIPE separated values, found 1 in: " + value, context);
   }
   String identifier = aTok.nextToken();
   if (aTok.hasMoreTokens()) {
     return new ParseResult.Fail(
         getTokenName() + " expects 3 PIPE separated values, found too many in: " + value,
         context);
   }
   Class<? extends Loadable> cl;
   if ("GLOBAL".equals(fileType)) {
     cl = CDOMObject.class;
   } else {
     cl = StringPClassUtil.getClassFor(fileType);
     if (cl == null) {
       throw new IllegalArgumentException(
           "Invalid Data Definition Location (no class): " + fileType);
     }
   }
   def.setUsableLocation(cl);
   def.setFactSetName(identifier);
   return ParseResult.SUCCESS;
 }
コード例 #2
0
 @Override
 public String[] unparse(LoadContext context, FactSetDefinition def) {
   Class cl = def.getUsableLocation();
   String name = def.getFactSetName();
   if (cl == null) {
     if (name == null) {
       return null;
     } else {
       context.addWriteMessage("Found FactDefinition with location but no name");
       return null;
     }
   } else if (name == null) {
     context.addWriteMessage("Found FactDefinition with name but no location");
     return null;
   }
   return new String[] {StringPClassUtil.getStringFor(cl) + Constants.PIPE + name};
 }
コード例 #3
0
 @Override
 public String getIdentifierType() {
   return StringPClassUtil.getStringFor(getManagedClass());
 }