本文整理汇总了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();
}