Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,18 @@ public class ${gemInfo.gemName} implements Gem {
<#list gemInfo.gemValueInfos as gemValueInfo>
private final GemValue<${gemValueInfo.valueType.name}> ${gemValueInfo.name};
</#list>
<#if (gemInfo.gemValueInfos?size > 0) >
private final boolean isValid;
</#if>
private final AnnotationMirror mirror;

private ${gemInfo.gemName}( ${gemInfo.builderImplName} builder ) {
<#list gemInfo.gemValueInfos as gemValueInfo>
this.${gemValueInfo.name} = builder.${gemValueInfo.name};
</#list>
<#list gemInfo.gemValueInfos as gemValueInfo>
<#if gemValueInfo_index == 0>isValid = <#else> && </#if>( this.${gemValueInfo.name} != null ? this.${gemValueInfo.name}.isValid() : false )<#if !(gemValueInfo_has_next)>;</#if>
<#if gemValueInfo_index == 0>isValid = <#else> && </#if>( this.${gemValueInfo.name} != null && this.${gemValueInfo.name}.isValid() )<#if !(gemValueInfo_has_next)>;</#if>
</#list>
<#if gemInfo.gemValueInfos?size==0>
isValid = true;
</#if>
mirror = builder.mirror;
}

Expand All @@ -69,7 +68,11 @@ public class ${gemInfo.gemName} implements Gem {

@Override
public boolean isValid( ) {
<#if gemInfo.gemValueInfos?size == 0>
return true;
<#else>
return isValid;
</#if>
}

public static ${gemInfo.gemName} instanceOn(Element element) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@

public class BuilderGem implements Gem {

private final boolean isValid;
private final AnnotationMirror mirror;

private BuilderGem( BuilderImpl builder ) {
isValid = true;
mirror = builder.mirror;
}

Expand All @@ -36,7 +34,7 @@ public AnnotationMirror mirror( ) {

@Override
public boolean isValid( ) {
return isValid;
return true;
}

public static BuilderGem instanceOn(Element element) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,28 +70,28 @@ private SomeAnnotationGem( BuilderImpl builder ) {
this.myDouble = builder.myDouble;
this.myString = builder.myString;
this.myEnum = builder.myEnum;
isValid = ( this.myClassWithDefault != null ? this.myClassWithDefault.isValid() : false )
&& ( this.myBooleanWithDefault != null ? this.myBooleanWithDefault.isValid() : false )
&& ( this.myCharWithDefault != null ? this.myCharWithDefault.isValid() : false )
&& ( this.myByteWithDefault != null ? this.myByteWithDefault.isValid() : false )
&& ( this.mShortWithDefault != null ? this.mShortWithDefault.isValid() : false )
&& ( this.myIntWithDefault != null ? this.myIntWithDefault.isValid() : false )
&& ( this.myLongWithDefault != null ? this.myLongWithDefault.isValid() : false )
&& ( this.myFloatWithDefault != null ? this.myFloatWithDefault.isValid() : false )
&& ( this.myDoubleWithDefault != null ? this.myDoubleWithDefault.isValid() : false )
&& ( this.myStringWithDefault != null ? this.myStringWithDefault.isValid() : false )
&& ( this.myEnumWithDefault != null ? this.myEnumWithDefault.isValid() : false )
&& ( this.myClass != null ? this.myClass.isValid() : false )
&& ( this.myBoolean != null ? this.myBoolean.isValid() : false )
&& ( this.myChar != null ? this.myChar.isValid() : false )
&& ( this.myByte != null ? this.myByte.isValid() : false )
&& ( this.myShort != null ? this.myShort.isValid() : false )
&& ( this.myInt != null ? this.myInt.isValid() : false )
&& ( this.myLong != null ? this.myLong.isValid() : false )
&& ( this.myFloat != null ? this.myFloat.isValid() : false )
&& ( this.myDouble != null ? this.myDouble.isValid() : false )
&& ( this.myString != null ? this.myString.isValid() : false )
&& ( this.myEnum != null ? this.myEnum.isValid() : false );
isValid = ( this.myClassWithDefault != null && this.myClassWithDefault.isValid() )
&& ( this.myBooleanWithDefault != null && this.myBooleanWithDefault.isValid() )
&& ( this.myCharWithDefault != null && this.myCharWithDefault.isValid() )
&& ( this.myByteWithDefault != null && this.myByteWithDefault.isValid() )
&& ( this.mShortWithDefault != null && this.mShortWithDefault.isValid() )
&& ( this.myIntWithDefault != null && this.myIntWithDefault.isValid() )
&& ( this.myLongWithDefault != null && this.myLongWithDefault.isValid() )
&& ( this.myFloatWithDefault != null && this.myFloatWithDefault.isValid() )
&& ( this.myDoubleWithDefault != null && this.myDoubleWithDefault.isValid() )
&& ( this.myStringWithDefault != null && this.myStringWithDefault.isValid() )
&& ( this.myEnumWithDefault != null && this.myEnumWithDefault.isValid() )
&& ( this.myClass != null && this.myClass.isValid() )
&& ( this.myBoolean != null && this.myBoolean.isValid() )
&& ( this.myChar != null && this.myChar.isValid() )
&& ( this.myByte != null && this.myByte.isValid() )
&& ( this.myShort != null && this.myShort.isValid() )
&& ( this.myInt != null && this.myInt.isValid() )
&& ( this.myLong != null && this.myLong.isValid() )
&& ( this.myFloat != null && this.myFloat.isValid() )
&& ( this.myDouble != null && this.myDouble.isValid() )
&& ( this.myString != null && this.myString.isValid() )
&& ( this.myEnum != null && this.myEnum.isValid() );
mirror = builder.mirror;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class SomeAnnotationsGem implements Gem {

private SomeAnnotationsGem( BuilderImpl builder ) {
this.value = builder.value;
isValid = ( this.value != null ? this.value.isValid() : false );
isValid = ( this.value != null && this.value.isValid() );
mirror = builder.mirror;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ private SomeArrayAnnotationGem( BuilderImpl builder ) {
this.myBooleanWithDefault = builder.myBooleanWithDefault;
this.myEnumWithDefault = builder.myEnumWithDefault;
this.myAnnotation = builder.myAnnotation;
isValid = ( this.myClassWithDefault != null ? this.myClassWithDefault.isValid() : false )
&& ( this.myBooleanWithDefault != null ? this.myBooleanWithDefault.isValid() : false )
&& ( this.myEnumWithDefault != null ? this.myEnumWithDefault.isValid() : false )
&& ( this.myAnnotation != null ? this.myAnnotation.isValid() : false );
isValid = ( this.myClassWithDefault != null && this.myClassWithDefault.isValid() )
&& ( this.myBooleanWithDefault != null && this.myBooleanWithDefault.isValid() )
&& ( this.myEnumWithDefault != null && this.myEnumWithDefault.isValid() )
&& ( this.myAnnotation != null && this.myAnnotation.isValid() );
mirror = builder.mirror;
}

Expand Down