Skip to content

Commit

Permalink
Add generating-complex-types page of generating-objects section for k…
Browse files Browse the repository at this point in the history
…or doc (#894)

* chore(docs) : add english text to be compared

* fix(docs) : translate korean

* fix(docs) : correction of vocabulary

* fix(docs) : modify to be the same as the previous document too
  • Loading branch information
this-is-spear authored and SooKim1110 committed Mar 18, 2024
1 parent 79795fb commit 5b5c1a9
Showing 1 changed file with 117 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,120 @@ identifier: "generating-complex-types"
weight: 32
---

### 한국어 번역 필요
Fixture Monkey는 직접 생성하기 어려운 복잡한 객체도 테스트 픽스처로 쉽게 생성할 수 있습니다.

이 페이지는 생성할 수 있는 다양한 타입의 객체를 보여줍니다.

## Java
### Generic Objects
```java
@Value
public static class GenericObject<T> {
T foo;
}

@Value
public static class GenericArrayObject<T> {
GenericObject<T>[] foo;
}

@Value
public static class TwoGenericObject<T, U> {
T foo;
U bar;
}

@Value
public static class ThreeGenericObject<T, U, V> {
T foo;
U bar;
V baz;
}
```

### Generic Interfaces
```java
public interface GenericInterface<T> {
}

@Value
public static class GenericInterfaceImpl<T> implements GenericInterface<T> {
T foo;
}

public interface TwoGenericInterface<T, U> {
}

@Value
public static class TwoGenericImpl<T, U> implements TwoGenericInterface<T, U> {
T foo;

U bar;
}
```

### SelfReference
```java
@Value
public class SelfReference {
String foo;
SelfReference bar;
}

@Value
public class SelfReferenceList {
String foo;
List<SelfReferenceList> bar;
}
```

### Interface
```java
public interface Interface {
String foo();

Integer bar();
}

public interface InheritedInterface extends Interface {
String foo();
}

public interface InheritedInterfaceWithSameNameMethod extends Interface {
String foo();
}

public interface ContainerInterface {
List<String> baz();

Map<String, Integer> qux();
}

public interface InheritedTwoInterface extends Interface, ContainerInterface {
}
```

## Kotlin
### Generic Objects
```kotlin
class Generic<T>(val foo: T)

class GenericImpl(val foo: Generic<String>)
```

### SelfReference
```kotlin
class SelfReference(val foo: String, val bar: SelfReference?)
```

### Sealed class, Value class
```kotlin
sealed class SealedClass

object ObjectSealedClass : SealedClass()

class SealedClassImpl(val foo: String) : SealedClass()

@JvmInline
value class ValueClass(val foo: String)
```

0 comments on commit 5b5c1a9

Please sign in to comment.