Skip to content

build: remove connector-utils#15

Merged
ali-ince merged 2 commits intomainfrom
connect_utils_removal
Oct 15, 2023
Merged

build: remove connector-utils#15
ali-ince merged 2 commits intomainfrom
connect_utils_removal

Conversation

@meistermeier
Copy link
Contributor

No description provided.

@meistermeier meistermeier requested a review from ali-ince October 11, 2023 10:25
@neo-technology-commit-status-publisher
Copy link
Collaborator

neo-technology-commit-status-publisher commented Oct 11, 2023

Warnings
⚠️ ❗ Please include a description of your PR changes.

Pull request should have a description of the underlying changes.

Generated by 🚫 dangerJS against f66171f

Copy link
Contributor

@ali-ince ali-ince left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great clean-up, look to all the dependencies removed in the license notices 🎉


import org.slf4j.LoggerFactory

class VersionUtil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could basically go for object VersionUtil here and get rid of the companion object?

import org.apache.kafka.common.config.AbstractConfig
import org.apache.kafka.common.config.ConfigDef

class ConfigUtils {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could go with object ConfigUtils here and remove companion object?

class ConfigUtils {
companion object {
inline fun <reified E : Enum<E>> getEnum(
configClass: Class<E>, // <-- even if it's unused, it is needed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we remove this line, and add type parameters on the caller site seems to be compiling at least.

}
}

class ConfigKeyBuilder private constructor(name: String, type: ConfigDef.Type) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, just as an exercise, how would it look like if we have all the var fields public which will make them properties, getting rid of the setter methods, and change the of functions to something like this:

fun of(group: String, name: String, type: ConfigDef.Type, init: ConfigKeyBuilder.() -> Unit): ConfigDef.ConfigKey {
      val builder = ConfigKeyBuilder(group, name, type)
      init(builder)
      return builder.build()
}

this would end up with a usage like;

this.define(
            ConfigKeyBuilder.of(Neo4jConfiguration.URI, ConfigDef.Type.LIST) {
              displayName = "URI"
              documentation = PropertiesUtil.getProperty(Neo4jConfiguration.URI)
              group = CONNECTION.title
              importance = Importance.HIGH
              validator =
                  Validators.uri("neo4j", "neo4j+s", "neo4j+ssc", "bolt", "bolt+s", "bolt+ssc")
            })

not sure if it's worth the effort, but feels like more kotlin-esque.

wdyt?

type: ConfigDef.Type,
init: ConfigKeyBuilder.() -> Unit
): ConfigDef.ConfigKey {
val builder = ConfigKeyBuilder(group, name, type)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can have a single constructor and a single of if you declare default values

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the first one was never called -> removed

fun of(name: String, type: ConfigDef.Type): ConfigKeyBuilder {
return ConfigKeyBuilder(name, type)
fun of(
group: String,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't it be name here? (based on the corresponding constructor's signature)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for spotting this.

@meistermeier meistermeier force-pushed the connect_utils_removal branch from 9d529c8 to 1923038 Compare October 13, 2023 08:07
Copy link
Contributor

@ali-ince ali-ince left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me.

@meistermeier meistermeier force-pushed the connect_utils_removal branch from 1923038 to d947d30 Compare October 13, 2023 14:30
@ali-ince ali-ince merged commit f5fbdfd into main Oct 15, 2023
@ali-ince ali-ince deleted the connect_utils_removal branch October 15, 2023 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants