Skip to content

Commit

Permalink
Issue highsource#11. Minor fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
highsource committed Dec 7, 2014
1 parent 3a1de27 commit c70d481
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ private HashCodeArguments spawn(JVar value, JExpression hasSetValue) {
public HashCodeArguments property(JBlock block, String propertyName,
String propertyMethod, JType declarablePropertyType,
JType propertyType, Collection<JType> possiblePropertyTypes) {
block.assign(currentHashCode(),
currentHashCode().mul(JExpr.lit(multiplier())));
final JVar propertyValue = block.decl(JMod.FINAL,
declarablePropertyType, value().name() + propertyName, value()
.invoke(propertyMethod));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,9 @@
public class HashCodeCodeGenerationImplementor extends
AbstractCodeGenerationImplementor<HashCodeArguments> {

private int multiplier;

public HashCodeCodeGenerationImplementor(JCodeModel codeModel,
int multiplier) {
public HashCodeCodeGenerationImplementor(JCodeModel codeModel) {
super(codeModel);
this.multiplier = multiplier;
}

public int getMultiplier() {
return multiplier;
}

private void ifHasSetValueAssignPlusValueHashCode(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
public class HashCodeCodeGenerator extends
CodeGenerationAbstraction<HashCodeArguments> {

public HashCodeCodeGenerator(JCodeModel codeModel, int multiplier) {
public HashCodeCodeGenerator(JCodeModel codeModel) {
super(
new HashCodeCodeGenerationImplementor(
Validate.notNull(codeModel), multiplier));
Validate.notNull(codeModel)));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private int getMultiplier() {
@Override
protected CodeGenerator<HashCodeArguments> createCodeGenerator(
JCodeModel codeModel) {
return new HashCodeCodeGenerator(codeModel, getMultiplier());
return new HashCodeCodeGenerator(codeModel);
}

@Override
Expand Down

0 comments on commit c70d481

Please sign in to comment.