コード例 #1
0
  @Nullable
  public Object getData(
      long receiverId, long senderId, NidVer nidVer, short typeIndex, IDataGetter dataGetter)
      throws NodeNotFoundException {
    final NodeImpl node =
        this.nodes.getByUserId(receiverId).getNode(nidVer.getNid(), nidVer.getVersion(), false);
    if (node == null) {
      throw new NodeNotFoundException("Node not found");
    }
    final long classId = node.getNodeSerie().getClassId();

    final NodeClass nc = this.ncApi.getClassById(classId);
    if (nc == null) {
      throw new IllegalStateException("NodeClass not found");
    }
    final IType type = nc.getType(typeIndex);
    final boolean supports = type.supports(dataGetter);
    if (!supports) {
      throw new ExpectableException("The given data getter is no supported on this type.");
    }
    // ITypeImpl ti = this.typesRegistry.get(type.getRef());
    final Object value = node.getData()[typeIndex];
    return type.getData(dataGetter, value);
  }