1 8 9 package com.sleepycat.persist.impl; 10 11 import java.util.Set ; 12 13 import com.sleepycat.persist.model.ClassMetadata; 14 import com.sleepycat.persist.model.EntityMetadata; 15 import com.sleepycat.persist.model.EntityModel; 16 17 24 class StoredModel extends EntityModel { 25 26 private PersistCatalog catalog; 27 private Set <String > knownClasses; 28 29 StoredModel(PersistCatalog catalog) { 30 this.catalog = catalog; 31 } 32 33 @Override 34 public ClassMetadata getClassMetadata(String className) { 35 ClassMetadata metadata = null; 36 Format format = catalog.getFormat(className); 37 if (format != null && format.isCurrentVersion()) { 38 metadata = format.getClassMetadata(); 39 } 40 return metadata; 41 } 42 43 @Override 44 public EntityMetadata getEntityMetadata(String className) { 45 EntityMetadata metadata = null; 46 Format format = catalog.getFormat(className); 47 if (format != null && format.isCurrentVersion()) { 48 metadata = format.getEntityMetadata(); 49 } 50 return metadata; 51 } 52 53 @Override 54 public Set <String > getKnownClasses() { 55 if (knownClasses == null) { 56 knownClasses = catalog.getModelClasses(); 57 } 58 return knownClasses; 59 } 60 } 61 | Popular Tags |