SlingModelPersist type handling cleanup#73
Conversation
| */ | ||
| package org.apache.sling.models.persistor; | ||
|
|
||
| import com.drew.lang.annotations.NotNull; |
There was a problem hiding this comment.
@badvision any particular reason for changing annotation types? A number of other projects use the Jetbrains annotations, so it'd be better to be consistent
There was a problem hiding this comment.
Hmm good point, I think that was an oversight as I was having difficulty building in this one case -- happy to revert them back.
| */ | ||
| package org.apache.sling.models.persistor.impl; | ||
|
|
||
| import com.drew.lang.annotations.NotNull; |
There was a problem hiding this comment.
Same comment re:annotation
| private static String getNodeType(Object obj) throws IllegalArgumentException, IllegalAccessException { | ||
| for (Field f : obj.getClass().getDeclaredFields()) { | ||
| Named namedAnnotation = f.getAnnotation(Named.class); | ||
| if (namedAnnotation != null && namedAnnotation.value().equals("jcr:primaryType")) { |
There was a problem hiding this comment.
There was a problem hiding this comment.
agree, I try to avoid hard-coding too. Thanks for catching that.
|
SonarCloud Quality Gate failed. |
|
SonarCloud Quality Gate failed.
|
|
|
2 similar comments
|
|















This cleans up how primary type and resource type are managed. I removed the child content type feature because it was too confusing to use and even more confusing in the code implementation. Now if you want a jcr:content child, add a content property to your object and use a @nAmed("jcr:content") annotation. This means that the java object graph should be more or less identical to the jcr node graph.