Skip to content

Commit d9263ec

Browse files
committed
docs: update kavaref-extension
1 parent e2ee886 commit d9263ec

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

docs-source/src/en/library/kavaref-extension.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,11 @@ Please change `<version>` to the version displayed at the top of this document.
4444

4545
You can view the KDoc [click here](kdoc://kavaref-extension).
4646

47-
### Class Extensions
47+
### Class Extension
4848

49-
KavaRef provides some extensions that are more convenient when dealing with `Class` objects.
49+
KavaRef provides convenient extensions when dealing with `Class` objects.
5050

51-
KavaRef also adds `KClass` extensions to the `Class` extensions,
52-
which is used to call `KClass.java`, making it more concise than using `Some::class.java` directly.
51+
KavaRef also brings these extensions to `KClass`, allowing you to call `KClass.java` more concisely than using `Some::class.java` directly.
5352

5453
#### Create Class Object
5554

@@ -101,7 +100,7 @@ You can also use the `hasSuperclass` and `hasInterfaces` methods to determine wh
101100
::: danger
102101

103102
The `Class` passed in by the `classOf` method will perform unboxing of Java wrapper classes by default,
104-
whether you pass in something like `kotlin.Boolean` or `java.lang.Boolean` (see [Java Wrapper Classes Extensions](#java-wrapper-classes-extensions) below),
103+
whether you pass in something like `kotlin.Boolean` or `java.lang.Boolean` (see [Java Wrapper Classes Extension](#java-wrapper-classes-extension) below),
105104
If you need to avoid the incoming `Class` being unboxed into primitive types, you need to explicitly set the `primitiveType = false` parameter.
106105

107106
:::
@@ -189,7 +188,7 @@ myClassOrNull?.resolve()
189188
otherClassOrNull?.resolve()
190189
```
191190

192-
#### ClassLoader Extensions
191+
#### ClassLoader Extension
193192

194193
KavaRef also provides some practical extension methods for `ClassLoader`.
195194

@@ -204,7 +203,7 @@ val myClassOrNull = classLoader.loadClassOrNull("com.example.MyClass")
204203
val isClassExists = classLoader.hasClass("com.example.MyClass")
205204
```
206205

207-
### Array Class Extensions
206+
### Array Class Extension
208207

209208
In Java, the `Class` object of an array is a special `Class` object, and usually we create it as follows.
210209

@@ -226,7 +225,7 @@ Now, the `Class` object that creates `java.lang.String[]` can be written like th
226225
val arrayClass = ArrayClass(String::class)
227226
```
228227

229-
### Member Extensions
228+
### Member Extension
230229

231230
KavaRef provides some extension methods to simplify operations on `Member`.
232231

@@ -245,7 +244,7 @@ method.makeAccessible()
245244

246245
Similarly, KavaRef also extends `Modifier`, and you can directly use `Member.isPublic` and other methods to judge a `Member` modifier.
247246

248-
### Type Extensions
247+
### Type Extension
249248

250249
When manipulating types or generic types in Java, you usually need to use the `Type` interface and its subinterface to handle it.
251250

@@ -287,7 +286,7 @@ val myClass: Class<*>
287286
val arguments = myClass.genericSuperclassTypeArguments()
288287
```
289288

290-
### Type Reference Extensions
289+
### Type Reference Extension
291290

292291
In Java, method generics are erased after compilation, and the type obtained at runtime is `java.lang.Object`.
293292

@@ -319,7 +318,7 @@ inline fun <reified T : Any> T.toJson(): String = gson.toJson(this, typeRef<T>()
319318
val json = listOf("KavaRef", "is", "awesome").toJson()
320319
```
321320

322-
### Java Wrapper Classes Extensions
321+
### Java Wrapper Classes Extension
323322

324323
In Kotlin, you can directly use `Boolean::class`, `Byte::class`, etc. to obtain Java's original types `boolean` and `byte` instead of their wrapper classes.
325324

0 commit comments

Comments
 (0)