com.haulmont.chile.core.model.MetaClass.getOwnProperties()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(139)

本文整理了Java中com.haulmont.chile.core.model.MetaClass.getOwnProperties()方法的一些代码示例,展示了MetaClass.getOwnProperties()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MetaClass.getOwnProperties()方法的具体详情如下:
包路径:com.haulmont.chile.core.model.MetaClass
类名称:MetaClass
方法名:getOwnProperties

MetaClass.getOwnProperties介绍

暂无

代码示例

代码示例来源:origin: com.haulmont.cuba/cuba-gui

protected List<MetaProperty> getEnumProperties(MetaClass metaClass) {
  return metaClass.getOwnProperties().stream()
          .filter(p -> p.getRange().isEnum())
          .collect(Collectors.toList());
}

代码示例来源:origin: com.haulmont.charts/charts-gui

protected boolean isEmbeddedIdProperty(String property, MetaClass metaClass) {
  MetaClass embeddedMetaClass = getEmbeddedIdMetaClass(metaClass);
  if (embeddedMetaClass == null) {
    return false;
  }
  String[] propertyPathParts = property.split("\\.");
  String propertyName = propertyPathParts[propertyPathParts.length - 1];
  MetaProperty metaProperty = embeddedMetaClass.getProperty(propertyName);
  return embeddedMetaClass.getOwnProperties().contains(metaProperty);
}

代码示例来源:origin: com.haulmont.cuba/cuba-global

public static String printClass(MetaClass metaClass) {
  StringBuilder builder = new StringBuilder();
  builder.append(metaClass.getName()).append("\n");
  for (MetaProperty metaProperty : metaClass.getOwnProperties()) {
    builder.append(shift(metaProperty.getName() + ": " + metaProperty.getRange()));
  }
  return builder.toString();
}

代码示例来源:origin: com.haulmont.charts/charts-gui

protected List<String> getEmbeddedIdProperties(MetaClass metaClass) {
  List<String> result = new ArrayList<>();
  if (hasEmbeddedId(metaClass)) {
    MetaClass embeddedMetaClass = getEmbeddedIdMetaClass(metaClass);
    if (embeddedMetaClass == null) {
      return null;
    }
    String primaryKey = metadata.getTools().getPrimaryKeyName(metaClass);
    for (MetaProperty metaProperty : embeddedMetaClass.getOwnProperties()) {
      result.add(primaryKey + "." + metaProperty.getName());
    }
  }
  return result;
}

代码示例来源:origin: com.haulmont.cuba/cuba-core

private void setMultipleTableConstraintDependency(MetaClass metaClass, ClassDescriptor desc) {
  InheritancePolicy policy = desc.getInheritancePolicyOrNull();
  if (policy != null && policy.isJoinedStrategy() && policy.getParentClass() != null) {
    boolean hasOneToMany = metaClass.getOwnProperties().stream().anyMatch(metaProperty ->
        metadata.getTools().isPersistent(metaProperty)
            && metaProperty.getRange().isClass()
            && metaProperty.getRange().getCardinality() == Range.Cardinality.ONE_TO_MANY);
    if (hasOneToMany) {
      desc.setHasMultipleTableConstraintDependecy(true);
    }
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-global

protected void postProcessClass(MetaClass metaClass) {
  for (MetaProperty property : metaClass.getOwnProperties()) {
    postProcessProperty(metaClass, property);
  }
  Collection<MetaClass> missingDescendants = new HashSet<>(1);
  findMissingDescendants(metaClass, missingDescendants);
  if (!missingDescendants.isEmpty()) {
    CollectionUtils.addAll(metaClass.getDescendants(), missingDescendants.iterator());
    MetaClass ancestorMetaClass = metaClass.getAncestor();
    while (ancestorMetaClass != null) {
      CollectionUtils.addAll(ancestorMetaClass.getDescendants(), missingDescendants.iterator());
      ancestorMetaClass = ancestorMetaClass.getAncestor();
    }
  }
  MetaClass ancestorMetaClass = metaClass.getAncestor();
  while (ancestorMetaClass != null) {
    ((MetaClassImpl) metaClass).addAncestor(ancestorMetaClass);
    ancestorMetaClass = ancestorMetaClass.getAncestor();
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

protected void afterLoadValues(Map<String, Object> params, ValueLoadContext context, List<KeyValueEntity> entities) {
  ds.detachListener(ds.data.values());
  ds.data.clear();
  boolean hasEnumerations = ds.metaClass.getOwnProperties().stream()
      .anyMatch(p -> p.getRange().isEnum());
  if (!hasEnumerations) {
    for (KeyValueEntity entity : entities) {
      ds.data.put(entity.getId(), entity);
      ds.attachListener(entity);
      entity.setMetaClass(ds.metaClass);
    }
  } else {
    List<MetaProperty> enumProperties = getEnumProperties(ds.metaClass);
    for (KeyValueEntity entity : entities) {
      convertEnumValues(entity, enumProperties);
      ds.data.put(entity.getId(), entity);
      ds.attachListener(entity);
      entity.setMetaClass(ds.metaClass);
    }
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-global

for (MetaProperty metaProperty : metaClass.getOwnProperties()) {
  MetaPropertyImpl propertyImpl = (MetaPropertyImpl) metaProperty;

相关文章