Skip to content

Commit

Permalink
Add BytecodeExpressions.defaultValue that takes ParameterizedType
Browse files Browse the repository at this point in the history
  • Loading branch information
haozhun committed Sep 20, 2016
1 parent 8d8ac52 commit 581c130
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ public static BytecodeExpression constantString(String value)
return new ConstantBytecodeExpression(String.class, loadString(value));
}

public static BytecodeExpression defaultValue(ParameterizedType type)
{
if (type.isPrimitive()) {
return defaultValue(type.getPrimitiveType());
}
return constantNull(type);
}

public static BytecodeExpression defaultValue(Class<?> type)
{
requireNonNull(type, "type is null");
Expand Down

0 comments on commit 581c130

Please sign in to comment.