diff --git a/README.md b/README.md index e857654..a9bc92e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Java nameOfProperty implementation ================================== -Java alternative to nameOf operator. +Java alternative to [nameOf](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/nameof) operator. [![license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) [![Download](https://api.bintray.com/packages/strangeway-org/libs/nameof/images/download.svg) ](https://bintray.com/strangeway-org/libs/nameof/_latestVersion) diff --git a/src/main/java/org/strangeway/nameof/LangUtils.java b/src/main/java/org/strangeway/nameof/LangUtils.java index fc30d75..c103fa4 100644 --- a/src/main/java/org/strangeway/nameof/LangUtils.java +++ b/src/main/java/org/strangeway/nameof/LangUtils.java @@ -25,6 +25,10 @@ * Utility class that can provide name of bean property using method reference of a getter. */ public final class LangUtils { + public static String nameOf(Class clazz) { + return clazz.getName(); + } + public static String nameOfProperty(Class clazz, Function bridge) { T extractor = PropertyNames.getPropertyNameExtractor(clazz); bridge.apply(extractor);