コード例 #1
0
 static Format checkRawType(Catalog catalog, Object o, Format declaredFormat) {
   assert declaredFormat != null;
   Format format;
   if (o instanceof RawObject) {
     format = (Format) ((RawObject) o).getType();
   } else {
     format = catalog.getFormat(o.getClass());
     if (!format.isSimple() || format.isEnum()) {
       throw new IllegalArgumentException(
           "Not a RawObject or a non-enum simple type: " + format.getClassName());
     }
   }
   if (!format.isAssignableTo(declaredFormat)) {
     throw new IllegalArgumentException(
         "Not a subtype of the field's declared class "
             + declaredFormat.getClassName()
             + ": "
             + format.getClassName());
   }
   if (!format.isCurrentVersion()) {
     throw new IllegalArgumentException(
         "Raw type version is not current.  Class: "
             + format.getClassName()
             + " Version: "
             + format.getVersion());
   }
   Format proxiedFormat = format.getProxiedFormat();
   if (proxiedFormat != null) {
     format = proxiedFormat;
   }
   return format;
 }
コード例 #2
0
ファイル: StoredModel.java プロジェクト: nologic/nabs
 @Override
 public EntityMetadata getEntityMetadata(String className) {
   EntityMetadata metadata = null;
   Format format = catalog.getFormat(className);
   if (format != null && format.isCurrentVersion()) {
     metadata = format.getEntityMetadata();
   }
   return metadata;
 }