コード例 #1
0
  public static String resource(Tree<Location> entityTree) {
    String entityType = SchemaRules.getSchemaType(entityTree);
    String brokerType = BrokerRules.getBrokerType(entityTree);
    String superClassParameterName = entityType.toLowerCase().replace("_", "");

    ResourceTemplate template = new ResourceTemplate();
    template.set("entity_type", entityType);
    template.set("broker_type", brokerType);
    template.set("superclass_parameter_name", superClassParameterName);
    return template.evaluate();
  }
コード例 #2
0
  public static String update(Tree<Location> entityTree, DetailedLink link) {
    Object[] result = HeaderUtils.generateMethodParams(link);
    String headersMethodParamsStr = (String) result[0];
    String headersMapParamsStr = (String) result[1];

    headersMethodParamsStr = !headersMethodParamsStr.isEmpty() ? ", " + headersMethodParamsStr : "";

    ResourceUpdateTemplate template = new ResourceUpdateTemplate();
    template.set("url", link.getHref());
    template.set("entity_name", LocationRules.getName(entityTree));
    template.set("entity_broker_type", BrokerRules.getBrokerType(entityTree));
    template.set("docs", Documentation.document(link));
    template.set("headers_map_params_str", headersMapParamsStr);
    template.set("headers_method_params_str", headersMethodParamsStr);

    return template.evaluate();
  }