本文整理匯總了Java中org.netbeans.modules.j2ee.persistence.util.MetadataModelReadHelper.State類的典型用法代碼示例。如果您正苦於以下問題:Java State類的具體用法?Java State怎麽用?Java State使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
State類屬於org.netbeans.modules.j2ee.persistence.util.MetadataModelReadHelper包,在下文中一共展示了State類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: init
import org.netbeans.modules.j2ee.persistence.util.MetadataModelReadHelper.State; //導入依賴的package包/類
@Override
public void init(WizardDescriptor wiz) {
// get the table names for all entities in the project
initProject = Templates.getProject(wiz);
final MetadataModelReadHelper<EntityMappingsMetadata, Set<Entity>> readHelper;
EntityClassScope entityClassScope = EntityClassScope.getEntityClassScope(initProject.getProjectDirectory());
if (entityClassScope == null) {
return;
}
MetadataModel<EntityMappingsMetadata> entityMappingsModel = entityClassScope.getEntityMappingsModel(true);
readHelper = MetadataModelReadHelper.create(entityMappingsModel, new MetadataModelAction<EntityMappingsMetadata, Set<Entity>>() {
@Override
public Set<Entity> run(EntityMappingsMetadata metadata) {
Set<Entity> result = new HashSet<Entity>();
result.addAll(Arrays.asList(metadata.getRoot().getEntity()));
return result;
}
});
readHelper.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (readHelper.getState() == State.FINISHED) {
try {
processEntities(readHelper.getResult());
} catch (ExecutionException ex) {
Logger.getLogger(JavaPersistenceGenerator.class.getName()).log(Level.FINE, "Failed to get entity classes: ", ex); //NOI18N
}
}
}
});
readHelper.start();
}
示例2: init
import org.netbeans.modules.j2ee.persistence.util.MetadataModelReadHelper.State; //導入依賴的package包/類
@Override
public void init(WizardDescriptor wiz) {
// get the table names for all entities in the project
initProject = Templates.getProject(wiz);
final MetadataModelReadHelper<EntityMappingsMetadata, Set<Entity>> readHelper;
EntityClassScope entityClassScope = EntityClassScope.getEntityClassScope(initProject.getProjectDirectory());
if (entityClassScope == null) {
return;
}
MetadataModel<EntityMappingsMetadata> entityMappingsModel = entityClassScope.getEntityMappingsModel(true);
readHelper = MetadataModelReadHelper.create(entityMappingsModel, (EntityMappingsMetadata metadata) -> {
Set<Entity> result1 = new HashSet<>();
result1.addAll(Arrays.asList(metadata.getRoot().getEntity()));
return result1;
});
readHelper.addChangeListener(e -> {
if (readHelper.getState() == State.FINISHED) {
try {
processEntities(readHelper.getResult());
} catch (ExecutionException ex) {
Logger.getLogger(JavaPersistenceModelGenerator.class.getName()).log(Level.FINE, "Failed to get entity classes: ", ex); //NOI18N
}
}
});
readHelper.start();
}
示例3: init
import org.netbeans.modules.j2ee.persistence.util.MetadataModelReadHelper.State; //導入依賴的package包/類
@Override
public void init(WizardDescriptor wiz) {
// get the table names for all entities in the project
initProject = Templates.getProject(wiz);
final MetadataModelReadHelper<EntityMappingsMetadata, Set<Entity>> readHelper;
EntityClassScope entityClassScope = EntityClassScope.getEntityClassScope(initProject.getProjectDirectory());
if (entityClassScope == null) {
return;
}
MetadataModel<EntityMappingsMetadata> entityMappingsModel = entityClassScope.getEntityMappingsModel(true);
readHelper = MetadataModelReadHelper.create(entityMappingsModel, new MetadataModelAction<EntityMappingsMetadata, Set<Entity>>() {
@Override
public Set<Entity> run(EntityMappingsMetadata metadata) {
Set<Entity> result = new HashSet<Entity>();
result.addAll(Arrays.asList(metadata.getRoot().getEntity()));
return result;
}
});
readHelper.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (readHelper.getState() == State.FINISHED) {
try {
processEntities(readHelper.getResult());
} catch (ExecutionException ex) {
Logger.getLogger(JavaPersistenceModelGenerator.class.getName()).log(Level.FINE, "Failed to get entity classes: ", ex); //NOI18N
}
}
}
});
readHelper.start();
}