Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create builder function for protocol #9

Open
jangalinski opened this issue Jan 18, 2024 · 0 comments
Open

Create builder function for protocol #9

jangalinski opened this issue Jan 18, 2024 · 0 comments
Labels
Type: enhancement New feature or request

Comments

@jangalinski
Copy link
Contributor

Scenario

Support creation of protocol declarations via builder functions.

Snippets

  // ------ PROTOCOL Snippets
  /**
   * Constructs a similar Protocol instance with the same `name`,
   * `doc`, and `namespace` as {code p} has. It also copies all the
   * `props`.
   */
//  fun Protocol(p: Protocol) {
//    this(p.name, p.doc, p.namespace)
//    putAll(p)
//  }

//  private fun setName(name: String, namespace: String?) {
//    val lastDot = name.lastIndexOf('.')
//    if (lastDot < 0) {
//      this.name = name
//      this.namespace = namespace
//    } else {
//      this.name = name.substring(lastDot + 1)
//      this.namespace = name.substring(0, lastDot)
//    }
//    if (this.namespace != null && this.namespace!!.isEmpty()) {
//      this.namespace = null
//    }
//    types.space(this.namespace)
//  }

//
//  /** Create a one-way message.  */
//  @Deprecated("")
//  fun createMessage(name: String?, doc: String?, request: Schema?): AvroProtocol.Message {
//    return AvroProtocol.Message(name!!, doc, emptyMap<String, Any>(), request!!)
//  }
//  /** Set the types of this protocol.  */
//  fun setTypes(newTypes: Collection<Schema?>) {
//    types = Schema.Names()
//    for (s in newTypes) types.add(s)
//  }
//
//  /**
//   * Create a one-way message using the `name`, `doc`, and
//   * `props` of `m`.
//   */
//  fun createMessage(m: AvroProtocol.Message, request: Schema): AvroProtocol.Message {
//    return AvroProtocol.Message(m.name, m.doc, m, request)
//  }
//
//  /** Create a one-way message.  */
//  fun <T> createMessage(name: String, doc: String?, propMap: JsonProperties?, request: Schema): AvroProtocol.Message {
//    return AvroProtocol.Message(name, doc, propMap, request)
//  }
//
//  /** Create a one-way message.  */
//  fun <T> createMessage(name: String, doc: String?, propMap: Map<String, *>, request: Schema): AvroProtocol.Message {
//    return AvroProtocol.Message(name, doc, propMap, request)
//  }
//
//  /** Create a two-way message.  */
//  @Deprecated("")
//  fun createMessage(name: String, doc: String?, request: Schema, response: Schema, errors: Schema): AvroProtocol.Message {
//    return AvroProtocol.TwoWayMessage(name, doc, LinkedHashMap<String, String>(), request, response, errors)
//  }
//
//  /**
//   * Create a two-way message using the `name`, `doc`, and
//   * `props` of `m`.
//   */
//  fun createMessage(m: AvroProtocol.Message, request: Schema, response: Schema, errors: Schema): AvroProtocol.Message {
//    return AvroProtocol.TwoWayMessage(m.name, m.doc, m, request, response, errors)
//  }
//
//  /** Create a two-way message.  */
//  fun <T> createMessage(
//    name: String, doc: String?, propMap: JsonProperties, request: Schema, response: Schema,
//    errors: Schema
//  ): AvroProtocol.Message {
//    return AvroProtocol.TwoWayMessage(name, doc, propMap, request, response, errors)
//  }
//
//  /** Create a two-way message.  */
//  fun <T> createMessage(
//    name: String, doc: String?, propMap: Map<String, *>, request: Schema, response: Schema,
//    errors: Schema
//  ): AvroProtocol.Message {
//    return AvroProtocol.TwoWayMessage(name, doc, propMap, request, response, errors)
//  }

@jangalinski jangalinski added the Type: enhancement New feature or request label Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant