本文整理了Java中com.haulmont.chile.core.model.MetaClass.getJavaClass()
方法的一些代码示例,展示了MetaClass.getJavaClass()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MetaClass.getJavaClass()
方法的具体详情如下:
包路径:com.haulmont.chile.core.model.MetaClass
类名称:MetaClass
方法名:getJavaClass
暂无
代码示例来源:origin: com.haulmont.cuba/cuba-global
/**
* INTERNAL. Import replaced meta class from metadata.
*/
public void registerReplacedMetaClass(MetaClass metaClass) {
replacedMetaClasses.put(metaClass.getJavaClass(), metaClass);
}
}
代码示例来源:origin: com.haulmont.cuba/cuba-global
@Override
public Entity create(MetaClass metaClass) {
return (Entity) __create(metaClass.getJavaClass());
}
代码示例来源:origin: com.haulmont.cuba/cuba-global
/**
* Determine whether the given metaclass represents a persistent entity.
* <p>
* A persistent entity is an entity that is managed by ORM (i.e. registered in a persistence.xml file)
* and is not a MappedSuperclass or Embeddable.
*/
public boolean isPersistent(MetaClass metaClass) {
checkNotNullArgument(metaClass, "metaClass is null");
return Boolean.TRUE.equals(metaClass.getAnnotations().get(PERSISTENT_ANN_NAME))
&& metaClass.getJavaClass().isAnnotationPresent(javax.persistence.Entity.class);
}
代码示例来源:origin: com.haulmont.cuba/cuba-global
/**
* @return collection of all embeddable entities
*/
public Collection<MetaClass> getAllEmbeddableMetaClasses() {
List<MetaClass> result = new ArrayList<>();
for (MetaClass metaClass : metadata.getSession().getClasses()) {
if (metaClass.getJavaClass().isAnnotationPresent(javax.persistence.Embeddable.class)) {
result.add(metaClass);
}
}
return result;
}
代码示例来源:origin: com.haulmont.cuba/cuba-global
/**
* Determine whether the given meta-class is persistent embeddable.
*/
public boolean isEmbeddable(MetaClass metaClass) {
checkNotNullArgument(metaClass, "metaClass is null");
return Boolean.TRUE.equals(metaClass.getAnnotations().get(PERSISTENT_ANN_NAME))
&& metaClass.getJavaClass().isAnnotationPresent(javax.persistence.Embeddable.class);
}
代码示例来源:origin: com.haulmont.cuba/cuba-core
public String getTableName() {
boolean isEmbeddable = meta.getJavaClass().isAnnotationPresent(Embeddable.class);
if (isEmbeddable)
return "not defined for embeddable entities";
MetadataTools metadataTools = AppBeans.get(MetadataTools.NAME);
String databaseTable = metadataTools.getDatabaseTable(meta);
return databaseTable != null ? databaseTable : "not defined";
}
代码示例来源:origin: de.diedavids.cuba.entitysoftreference/entity-soft-reference-global
protected LoadContext getLoadContextForForEntityLoadInfo(MetaClass metaClass, Object entityId) {
LoadContext loadContext = LoadContext.create(metaClass.getJavaClass());
loadContext
.setId(entityId);
return loadContext;
}
代码示例来源:origin: com.haulmont.cuba/cuba-gui
protected void registerPrimaryEditor(WindowInfo windowInfo, AnnotationMetadata annotationMetadata) {
Map<String, Object> primaryEditorAnnotation =
annotationMetadata.getAnnotationAttributes(PrimaryEditorScreen.class.getName());
if (primaryEditorAnnotation != null) {
Class entityClass = (Class) primaryEditorAnnotation.get("value");
if (entityClass != null) {
MetaClass metaClass = metadata.getClass(entityClass);
MetaClass originalMetaClass = metadata.getExtendedEntities().getOriginalOrThisMetaClass(metaClass);
primaryEditors.put(originalMetaClass.getJavaClass(), windowInfo);
}
}
}
代码示例来源:origin: com.haulmont.cuba/cuba-global
protected View deserializeView(JsonObject jsonObject) {
String viewName = jsonObject.getAsJsonPrimitive("name").getAsString();
String entityName = jsonObject.getAsJsonPrimitive("entity").getAsString();
JsonArray properties = jsonObject.getAsJsonArray("properties");
MetaClass metaClass = metadata.getClass(entityName);
if (metaClass == null) {
throw new ViewSerializationException(String.format("Entity with name %s not found", entityName));
}
View view = new View(metaClass.getJavaClass(), viewName, false);
fillViewProperties(view, properties, metaClass);
return view;
}
代码示例来源:origin: com.haulmont.reports/reports-global
@MetaProperty
@Transient
public String getNameForBand() {
return StringUtils.isEmpty(bandNameFromReport) ? getRegionPropertiesRootNode().getWrappedMetaClass().getJavaClass().getSimpleName() +
(isTabulatedRegion() ? "s" : "") +
(getReportData().getReportRegions().size() == 1 ? "" : getOrderNum().toString()) : bandNameFromReport;
}
代码示例来源:origin: com.haulmont.cuba/cuba-global
@Override
public Entity create(String entityName) {
MetaClass metaClass = getSession().getClassNN(entityName);
return (Entity) __create(metaClass.getJavaClass());
}
代码示例来源:origin: com.haulmont.cuba/cuba-global
/**
* @param metaClass of entity
* @return metaProperty name for loading entity from database by primary key stored in the database
*/
public String getPrimaryKeyForLoadingEntity(MetaClass metaClass) {
if (HasUuid.class.isAssignableFrom(metaClass.getJavaClass())) {
MetaProperty primaryKeyProperty = metadata.getTools().getPrimaryKeyProperty(metaClass);
if (primaryKeyProperty != null && !UUID.class.isAssignableFrom(primaryKeyProperty.getJavaType()))
return "uuid";
}
return metadata.getTools().getPrimaryKeyName(metaClass);
}
}
代码示例来源:origin: com.haulmont.cuba/cuba-global
@Nullable
protected MetadataObjectInfo<MetaClass> loadClass(String packageName, Class<?> javaClass, boolean persistent) {
MetaClassImpl metaClass = (MetaClassImpl) session.getClass(javaClass);
if (metaClass == null)
return null;
Collection<RangeInitTask> tasks = new ArrayList<>();
Collection<MetaClass> ancestors = metaClass.getAncestors();
for (MetaClass ancestor : ancestors) {
initProperties(ancestor.getJavaClass(), ((MetaClassImpl) ancestor), tasks);
}
initProperties(javaClass, metaClass, tasks);
return new MetadataObjectInfo<>(metaClass, tasks);
}
代码示例来源:origin: com.haulmont.cuba/cuba-gui
protected Map<String, MetaClass> getEntitiesLookupFieldOptions() {
Map<String, MetaClass> options = new TreeMap<>();
for (MetaClass metaClass : metadata.getTools().getAllPersistentMetaClasses()) {
if (readPermitted(metaClass)) {
Class javaClass = metaClass.getJavaClass();
if (Entity.class.isAssignableFrom(javaClass)) {
options.put(messages.getTools().getEntityCaption(metaClass) + " (" + metaClass.getName() + ")", metaClass);
}
}
}
return options;
}
代码示例来源:origin: com.haulmont.fts/fts-core
@Override
public MetaProperty getPrimaryKeyPropertyForFts(MetaClass metaClass) {
if (metadata.getTools().hasCompositePrimaryKey(metaClass) && HasUuid.class.isAssignableFrom(metaClass.getJavaClass())) {
return metaClass.getPropertyNN("uuid");
}
return metadata.getTools().getPrimaryKeyProperty(metaClass);
}
代码示例来源:origin: com.haulmont.cuba/cuba-core
@Override
public ResolvableType getResolvableType() {
ExtendedEntities extendedEntities = AppBeans.get(ExtendedEntities.NAME);
MetaClass metaClass = extendedEntities.getOriginalOrThisMetaClass(getEntity().getMetaClass());
return ResolvableType.forClassWithGenerics(getClass(), ResolvableType.forClass(metaClass.getJavaClass()));
}
}
代码示例来源:origin: com.haulmont.addon.dashboard/dashboard-web
protected void loadEntities(MetaClass metaClass) {
LoadContext loadContext = LoadContext.create(metaClass.getJavaClass())
.setQuery(LoadContext.createQuery(format("select e from %s e", metaClass.getName())));
List entities = dataManager.loadList(loadContext);
entitiesLookup.setOptionsList(entities);
}
代码示例来源:origin: com.haulmont.cuba/cuba-gui
protected View buildView(MetaClass metaClass, List<MetaProperty> props) {
View view = new View(metaClass.getJavaClass());
for (MetaProperty property : props) {
if (Entity.class.isAssignableFrom(property.getJavaType())) {
view.addProperty(property.getName(),
viewRepository.getView((Class) property.getJavaType(), View.MINIMAL));
} else {
view.addProperty(property.getName());
}
}
return view;
}
代码示例来源:origin: com.haulmont.addon.dashboard/dashboard-web
protected Entity loadEntity(EntityParameterValue parameter) {
Class entityClass = metadata.getClass(parameter.getMetaClassName()).getJavaClass();
LoadContext loadContext = LoadContext.create(entityClass)
.setId(java.util.UUID.fromString(parameter.getEntityId()))
.setView(parameter.getViewName());
return dataManager.load(loadContext);
}
代码示例来源:origin: com.haulmont.cuba/cuba-gui
protected Entity reloadInstance(Entity instance) {
View reloadView = new View(instance.getMetaClass().getJavaClass(), true);
LoadContext loadContext = new LoadContext(instance.getMetaClass());
loadContext.setSoftDeletion(false);
loadContext.setId(instance.getId());
loadContext.setView(reloadView);
DataSupplier supplier = getDataSupplier();
return supplier.load(loadContext);
}
内容来源于网络,如有侵权,请联系作者删除!