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
depluralizeDictionary
not working as expected
#1485
Comments
I've tried it and it works as documented /**
* Dictionary of exceptions — array of "singular:plural" pairs as alternative to mechanical "*s"
* depluralization. Suppress trimming of trailing "s" for certain words by using exceptions of
* form {@code "words:words"} or simply {@code "words"}. Important to note is that words will be
* converted to lowercase and identifier in question consists of couple of words joined using
* camel case — only a last segment will be considered for depluralization when matching
* dictionary. Uninterpretable pairs will be ignored. By default no dictionary is supplied and
* depluralization performed only by mechanical "*s" trimming.
* <p>
* This attribute is semi-deprecated in favor of using {@link Depluralize#dictionary()}
* annotation which may be placed on a package, type or as meta-annotation. And dictionary will
* be merged across all applicable definitions.
* @see #depluralize()
* @see Depluralize#dictionary()
* @return array of "singular:plural" pairs.
*/
String[] depluralizeDictionary() default {}; Your example tries to use depluralization as renaming and this is not an intended use. Only last word segment is considered for depluralization. |
Ah! I see, thanks for answering and sorry for not going deep into the documentation. May I ask if you have anything in the backlog for the requirement I have, where I wish singular and plural builders to have different names? |
Encodings can customize builders to a great degree, but those are based on the attribute type (overriding Another option is to just have very special style with convention. @Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.SOURCE)
@Value.Style(
typeImmutable = "*",
typeAbstract = ["*Def"],
builder = "configure",
build = "off",
put = "*",
add = "*",
get = ["*InOrder"], // <--- See this thing here, it would accept templatePathsInOrder accessor as "templatePaths"
depluralize = true,
visibility = PUBLIC
)
annotation class Config |
Here is my Style:
Here is my attribute
@SkipNulls fun templatePathsInOrder(): List<String>
Expected: It should generate a
templatePath()
methodBut it doesn't get generated.
Here is a sample project to demostrate: ImmutablesTest.java
The text was updated successfully, but these errors were encountered: