The document discusses MapStruct, which is a code generation library that simplifies mapping between Java bean classes. It provides several features for mapping source objects to target objects, including:
1. Mapping fields with the same name automatically.
2. Mapping fields with different names using the @Mapping annotation.
3. Mapping to nested/child objects by composing mappings and using additional mappers.
4. Mapping collection properties like lists.
5. Updating an existing target object instance by mapping from a source object.
It demonstrates how to configure MapStruct and implement mappings between simple POJO classes to copy and transform data between them. The generated implementation code handles null checking and population of the
The document discusses MapStruct, an open-source code generation library that simplifies object mapping in Java. It provides examples of how to configure MapStruct for different mapping use cases, including: basic property mapping between objects with same property names; mapping to objects with different property names; mapping multiple source objects to a single target object; and mapping collections. The examples demonstrate how to define mappings using annotations and how MapStruct generates implementation classes to perform the mappings.
The document discusses MapStruct, which is a code generation library that simplifies mapping between Java bean classes. It provides several features for mapping source objects to target objects, including:
1. Mapping fields with the same name automatically.
2. Mapping fields with different names using the @Mapping annotation.
3. Mapping to nested/child objects by composing mappings and using additional mappers.
4. Mapping collection properties like lists.
5. Updating an existing target object instance by mapping from a source object.
It demonstrates how to configure MapStruct and implement mappings between simple POJO classes to copy and transform data between them. The generated implementation code handles null checking and population of the
The document discusses MapStruct, an open-source code generation library that simplifies object mapping in Java. It provides examples of how to configure MapStruct for different mapping use cases, including: basic property mapping between objects with same property names; mapping to objects with different property names; mapping multiple source objects to a single target object; and mapping collections. The examples demonstrate how to define mappings using annotations and how MapStruct generates implementation classes to perform the mappings.
3. 1. Generic 이란
6. Generic
• 포괄적인,총칭의,회사이름이붙지않은,일반명칭으로판매되는사전적의미로,딱하나를정하지않고범용적이고포괄적이라는의미
• Data type을특정한type하나로정하지않고사용할때마다바뀔수있게범용적이고포괄적으로지정한다라는의미
• Object Class의한계를극복
• 호출되는시점에실제Generic 타입을지정
“ Data type을 특정한 type하나로 정하지 않고 사용할 때마다 바뀔 수 있게 범용적이고 포괄적으로 지정 “
6-1. Generic 이란
Generic
왜Generic가 만들어졌을까?
TypeCasting이빈번하게일어나서성능저하발생
-수만개의Data가있다면
java: incompatible types: java.lang.Object
cannot be converted to java.lang.String
Bast Code
4. 2. Generic Method
6. Generic
• Method 만들때파라메터와반환값의자료형을Generic로선언한Method
• 입력매개변수값으로Generic Type을유추할수있을경우는생략가능
• Generic Method 내부에서는 매개변수로 한 참조 변수의 메서드로 Object Class의 Method만 가능
6-1. Generic 이란
Generic Method
Generic Type 의미
T 타입 ( Type )
K 키 ( Key )
V 값 ( Value )
N 숫자 ( Number )
E 원소 ( Element )
➢ 관례적표기와의미
선언 : 접근지정자 < T [, ..] > T 메서드명( T t [, V v, … } );
➢ 문법구조
호출 : 참조객체.<실제 제네릭 타입>메서드명(입력매개변수)
입력 매개변수의 타입의 개수 만큼
입력 매개변수의 실제 타입을 의미함
5. 2. Generic Method
6. Generic
• extends : 매개 변수에 특정 타입만 받게 제한 할 때 사용
• 여러 개 사용시 임의로 타입 설정
6-1. Generic 이란
Generic Method -
첫번째 파라메터 : 문자
두번째 매개변수 : 숫자
세번째 파라메터 : Object