コード例 #1
0
ファイル: Dump.java プロジェクト: wangyaosnake/isis
  public static void specification(
      final ObjectSpecification specification, final DebugBuilder debugBuilder) {
    try {
      debugBuilder.appendTitle(specification.getClass().getName());
      debugBuilder.appendAsHexln("Hash code", specification.hashCode());
      debugBuilder.appendln("ID", specification.getIdentifier());
      debugBuilder.appendln("Full Name", specification.getFullIdentifier());
      debugBuilder.appendln("Short Name", specification.getShortIdentifier());
      debugBuilder.appendln("Singular Name", specification.getSingularName());
      debugBuilder.appendln("Plural Name", specification.getPluralName());
      debugBuilder.appendln("Description", specification.getDescription());
      debugBuilder.blankLine();
      debugBuilder.appendln("Features", featureList(specification));
      debugBuilder.appendln(
          "Type", specification.isParentedOrFreeCollection() ? "Collection" : "Object");
      if (specification.superclass() != null) {
        debugBuilder.appendln("Superclass", specification.superclass().getFullIdentifier());
      }
      debugBuilder.appendln("Interfaces", specificationNames(specification.interfaces()));
      debugBuilder.appendln("Subclasses", specificationNames(specification.subclasses()));
      debugBuilder.blankLine();
      debugBuilder.appendln("Service", specification.isService());
      debugBuilder.appendln("Encodable", specification.isEncodeable());
      debugBuilder.appendln("Parseable", specification.isParseable());
      debugBuilder.appendln("Aggregated", specification.isValueOrIsParented());
    } catch (final RuntimeException e) {
      debugBuilder.appendException(e);
    }

    if (specification instanceof DebuggableWithTitle) {
      ((DebuggableWithTitle) specification).debugData(debugBuilder);
    }

    debugBuilder.blankLine();

    debugBuilder.appendln("Facets");
    final Class<? extends Facet>[] facetTypes = specification.getFacetTypes();
    debugBuilder.indent();
    if (facetTypes.length == 0) {
      debugBuilder.appendln("none");
    } else {
      for (final Class<? extends Facet> type : facetTypes) {
        final Facet facet = specification.getFacet(type);
        debugBuilder.appendln(facet.toString());
      }
    }
    debugBuilder.unindent();
    debugBuilder.blankLine();

    debugBuilder.appendln("Fields");
    debugBuilder.indent();
    specificationFields(specification, debugBuilder);
    debugBuilder.unindent();

    debugBuilder.appendln("Object Actions");
    debugBuilder.indent();
    specificationActionMethods(specification, debugBuilder);
    debugBuilder.unindent();
  }
コード例 #2
0
ファイル: MetaModelRow.java プロジェクト: n0way/isis
 public String getClassType() {
   boolean service = false;
   for (ObjectSpecification subspecs : spec.subclasses()) {
     service = service || subspecs.isService();
   }
   return service || spec.isService()
       ? "2 Service"
       : spec.isValue()
           ? "3 Value"
           : spec.isParentedOrFreeCollection() ? "4 Collection" : "1 Object";
 }
コード例 #3
0
  private void findInstances(
      final ObjectSpecification spec,
      final PersistenceQueryBuiltIn persistenceQuery,
      final List<ObjectAdapter> foundInstances) {

    instancesFor(spec.getSpecId()).findInstancesAndAdd(persistenceQuery, foundInstances);

    // include subclasses
    final List<ObjectSpecification> subclasses = spec.subclasses();
    for (int i = 0; i < subclasses.size(); i++) {
      findInstances(subclasses.get(i), persistenceQuery, foundInstances);
    }
  }
コード例 #4
0
  @Override
  public boolean hasInstances(final ObjectSpecification spec) {
    if (instancesFor(spec.getSpecId()).hasInstances()) {
      return true;
    }

    // includeSubclasses
    final List<ObjectSpecification> subclasses = spec.subclasses();
    for (int i = 0; i < subclasses.size(); i++) {
      if (hasInstances(subclasses.get(i))) {
        return true;
      }
    }

    return false;
  }