Skip to content

Commit

Permalink
Resolve #225 Fix transient property not generated when used on an int…
Browse files Browse the repository at this point in the history
…erface type
  • Loading branch information
npurushe committed Jul 21, 2016
1 parent df1eb3f commit 69f913f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,14 @@ private void generateMembers(TypeSpec.Builder builder) {
Modifier memberVisibility = entity.isEmbedded() ? Modifier.PROTECTED : Modifier.PRIVATE;
// generate property states
if (!entity.isStateless()) {
for (AttributeDescriptor attribute : entity.attributes().values()) {
entity.attributes().values().stream()
.filter(attribute -> !attribute.isTransient())
.forEach(attribute -> {
TypeName stateType = ClassName.get(PropertyState.class);
builder.addField(FieldSpec
.builder(stateType, propertyStateFieldName(attribute), memberVisibility)
.build());
}
.builder(stateType, propertyStateFieldName(attribute), memberVisibility)
.build());
});
}
// only generate for interfaces or if the entity is immutable but has no builder
boolean generateMembers = typeElement.getKind().isInterface() ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import io.requery.PropertyNameStyle;
import io.requery.ReadOnly;
import io.requery.Table;
import io.requery.Transient;

import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.SourceVersion;
Expand Down Expand Up @@ -156,7 +155,6 @@ private boolean isMethodProcessable(ExecutableElement element) {
(isImmutable() || !element.getModifiers().contains(Modifier.FINAL)) &&
(!isImmutable() || !type.equals(element().asType())) &&
!type.equals(builderType().map(Element::asType).orElse(null)) &&
!Mirrors.findAnnotationMirror(element, Transient.class).isPresent() &&
!element.getModifiers().contains(Modifier.STATIC) &&
!name.equals("toString") && !name.equals("hashCode");
}
Expand Down

0 comments on commit 69f913f

Please sign in to comment.