Skip to content

Commit

Permalink
Added methodRefNew and enumConstantRef methods (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
phax committed Apr 15, 2019
1 parent 1b13280 commit 50c78ed
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/main/java/com/helger/jcodemodel/AbstractJClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,19 @@ public final JFieldRef staticRef (@Nonnull final JVar aField)
return new JFieldRef (this, aField);
}

/**
* Method reference for JDK8 (as in <code>String::valueOf</code>) for the
* special <code>::new</code>.
*
* @return Newly created {@link JLambdaMethodRef}
* @since 3.2.4
*/
@Nonnull
public final JLambdaMethodRef methodRefNew ()
{
return JLambdaMethodRef.createForNew (this);
}

/**
* Method reference for JDK8 (as in <code>String::valueOf</code>).
*
Expand All @@ -536,6 +549,18 @@ public final JLambdaMethodRef methodRef (@Nonnull final String sMethod)
return new JLambdaMethodRef (this, sMethod);
}

/**
* @param Enumeration
* constant name. May neither be <code>null</code> nor empty.
* @return <code>class.name</code>
* @since 3.2.4
*/
@Nonnull
public final IJExpression enumConstantRef (@Nonnull final String sName)
{
return JExpr.enumConstantRef (this, sName);
}

public void generate (@Nonnull final IJFormatter f)
{
f.type (this);
Expand Down

0 comments on commit 50c78ed

Please sign in to comment.