Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generating-complex-types page of generating-objects section for kor doc #894

Merged
merged 4 commits into from
Jan 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
```