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

Add getSupportedDocuments API to Barbershop #28

Merged
merged 2 commits into from Sep 10, 2019

Conversation

@wesleyk
Copy link
Collaborator

commented Sep 9, 2019

This enables clients to determine what types of Documents
are supported for a given DocumentData.

@wesleyk wesleyk requested review from hamdanjaveed and adrw Sep 9, 2019

@adrw
Copy link
Collaborator

left a comment

Thanks for the thorough contribution! 🎉

@@ -15,6 +15,9 @@ interface Barbershop {
documentClass: KClass<out D>
): Barber<DD, D>

fun <DD : DocumentData> getSupportedDocuments(documentDataClass: KClass<out DD>):

This comment has been minimized.

Copy link
@adrw

adrw Sep 10, 2019

Collaborator
  1. I lean towards getTargetDocuments as the function name to match the use of target in the DocumentTemplate API. Thoughts on changing the function name to that?

  2. Could you add a similar inline function with reified type to the bottom of this file similar to what exists for getBarber? Providing that and using it in tests would match the idiomatic style present throughout the rest of the library.

@wesleyk wesleyk force-pushed the wesley-api branch 2 times, most recently from 90823f4 to 090ffe3 Sep 10, 2019

}
}
return supportedDocuments.toSet()
}

This comment has been minimized.

Copy link
@hamdanjaveed

hamdanjaveed Sep 10, 2019

Collaborator

small nit: could be written as

override fun <DD : DocumentData> getTargetDocuments(documentDataClass: KClass<out DD>): Set<KClass<out Document>> = barbers.keys
  .filter { it.documentData == documentDataClass }
  .map { it.document }
  .toSet()
Add getTargetDocuments API to Barbershop
This enables clients to determine what types of Documents
are supported for a given DocumentData.

@wesleyk wesleyk force-pushed the wesley-api branch from 090ffe3 to cbc73eb Sep 10, 2019

@wesleyk wesleyk requested a review from adrw Sep 10, 2019

@wesleyk wesleyk merged commit abdef09 into master Sep 10, 2019

2 checks passed

ci/circleci: docs Your tests passed on CircleCI!
Details
ci/circleci: java Your tests passed on CircleCI!
Details
@adrw

This comment has been minimized.

Copy link
Collaborator

commented Sep 10, 2019

Looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.