Class PropertyProjector<S,T>
java.lang.Object
cn.dinodev.spring.commons.projection.PropertyProjector<S,T>
- Author:
- Cody Lu
-
Constructor Summary
ConstructorsConstructorDescriptionPropertyProjector(Class<S> sourceClass, Class<T> targetClass) Constructor with default conversion servicePropertyProjector(Class<S> sourceClass, Class<T> targetClass, org.springframework.core.convert.ConversionService conversionService) Constructor with specified conversion service -
Method Summary
Modifier and TypeMethodDescriptionadd(PropertyDescriptor getter, PropertyDescriptor setter) Add a property copier with specified json viewadd(PropertyDescriptor getter, PropertyDescriptor setter, Supplier<Function<?, ?>> converter) Add a property copier with specified json viewadd(PropertyDescriptor getter, String targetPropertyName, Function<?, ?> converter) Add a property copier with specified json viewAdd a property copierAdd a property copier with converter<V> PropertyProjector<S,T> add(Method sourceGetter, BiConsumer<T, V> setter) Add a property copier with specified json viewAdd a property copier with specified json viewAdd a property copier with specified json view<V> PropertyProjector<S,T> add(String sourcePropertyName, BiConsumer<T, V> setter) Add a property copier with specified json view<V> PropertyProjector<S,T> add(String sourcePropertyName, BiConsumer<T, V> setter, Function<V, V> converter) Add a property copier with specified json view<V> PropertyProjector<S,T> add(Function<S, V> getter, BiConsumer<T, V> setter) Add a property copier with specified json view<V> PropertyProjector<S,T> Add a property copier with specified json view<V> PropertyProjector<S,T> Add a property copier with specified json view<V> PropertyProjector<S,T> Add a property copier with specified json view<V> PropertyProjector<S,T> Add a property copier with specified json viewCopy the source object to the target objectCopy the source object to the target object with specified json viewCopy the source object to the target object with specified json viewCopy the source object to the target object with specified json viewCopy the source object to the target objectCopy the source object to the target object with specified json vieworg.springframework.core.convert.ConversionServiceGet the conversion servicevoidsetConversionService(org.springframework.core.convert.ConversionService conversionService) Set the conversion service
-
Constructor Details
-
PropertyProjector
Constructor with default conversion service- Parameters:
sourceClass-targetClass-
-
PropertyProjector
public PropertyProjector(@Nonnull Class<S> sourceClass, @Nonnull Class<T> targetClass, @Nullable org.springframework.core.convert.ConversionService conversionService) Constructor with specified conversion service- Parameters:
sourceClass-targetClass-conversionService-
-
-
Method Details
-
getConversionService
@Nullable public org.springframework.core.convert.ConversionService getConversionService()Get the conversion service- Returns:
-
setConversionService
public void setConversionService(@Nullable org.springframework.core.convert.ConversionService conversionService) Set the conversion service- Parameters:
conversionService-
-
copy
Copy the source object to the target object- Parameters:
source- source object- Returns:
-
copy
Copy the source object to the target object with specified json view- Parameters:
source- source objectactiveJsonView- json view class to filter the properties- Returns:
-
copy
Copy the source object to the target object- Parameters:
source- source objecttarget- target object- Returns:
-
copy
Copy the source object to the target object with specified json view- Parameters:
source- source objecttarget- target objectactiveJsonView- json view class to filter the properties- Returns:
-
copy
Copy the source object to the target object with specified json view- Parameters:
source- source objecttargetSupplier- target object supplier- Returns:
-
copy
Copy the source object to the target object with specified json view- Parameters:
source- source objecttargetSupplier- target object supplieractiveJsonView- json view class to filter the properties- Returns:
-
add
Add a property copier- Parameters:
sourceGetter- source getter methodtargetSetter- target setter method- Returns:
-
add
public PropertyProjector<S,T> add(Method sourceGetter, Method targetSetter, Function<?, ?> converter) Add a property copier with converter- Parameters:
sourceGetter- source getter methodtargetSetter- target setter methodconverter- converter function- Returns:
-
add
Add a property copier with specified json view- Parameters:
sourceGetter- source getter methodtargetSetter- target setter methodviews- json view classes- Returns:
-
add
Add a property copier with specified json view- Parameters:
sourceGetter- source getter methodsetter- target setter methodconverter- converter functionviews- json view classes- Returns:
- PropertyProjector
-
add
public PropertyProjector<S,T> add(String sourcePropertyName, String targetPropertyName, Function<?, ?> converter) Add a property copier with specified json view- Parameters:
sourceGetter- source getter methodsetter- target setter methodconverter- converter functionviews- json view classes- Returns:
-
add
public PropertyProjector<S,T> add(PropertyDescriptor getter, String targetPropertyName, Function<?, ?> converter) Add a property copier with specified json view- Parameters:
sourceGetter- source getter methodsetter- target setter methodconverter- converter functionviews- json view classes- Returns:
-
add
public PropertyProjector<S,T> add(PropertyDescriptor getter, PropertyDescriptor setter, Supplier<Function<?, ?>> converter) Add a property copier with specified json view- Parameters:
sourceGetter- source getter methodsetter- target setter methodconverter- converter functionviews- json view classes- Returns:
-
add
Add a property copier with specified json view- Parameters:
sourceGetter- source getter methodsetter- target setter methodconverter- converter functionviews- json view classes- Returns:
-
add
Add a property copier with specified json view- Parameters:
sourceGetter- source getter methodsetter- target setter methodconverter- converter functionviews- json view classes- Returns:
-
add
public <V> PropertyProjector<S,T> add(String sourcePropertyName, BiConsumer<T, V> setter, Function<V, V> converter) Add a property copier with specified json view- Parameters:
sourceGetter- source getter methodsetter- target setter methodconverter- converter functionviews- json view classes- Returns:
-
add
Add a property copier with specified json view- Parameters:
sourceGetter- source getter methodsetter- target setter methodconverter- converter functionviews- json view classes- Returns:
-
add
public <V> PropertyProjector<S,T> add(Function<S, V> getter, BiConsumer<T, V> setter, Class<?>... views) Add a property copier with specified json view- Parameters:
sourceGetter- source getter methodsetter- target setter methodconverter- converter functionviews- json view classes- Returns:
-
add
public <V> PropertyProjector<S,T> add(Function<S, V> getter, BiConsumer<T, V> setter, Class<?>[] getterViews, Class<?>[] setterViews) Add a property copier with specified json view- Parameters:
sourceGetter- source getter methodsetter- target setter methodconverter- converter functionviews- json view classes- Returns:
-
add
public <V> PropertyProjector<S,T> add(Function<S, V> getter, BiConsumer<T, V> setter, Function<V, V> converter) Add a property copier with specified json view- Parameters:
sourceGetter- source getter methodsetter- target setter methodconverter- converter functionviews- json view classes- Returns:
-
add
public <V> PropertyProjector<S,T> add(Function<S, V> getter, BiConsumer<T, V> setter, Function<V, V> converter, Class<?>... views) Add a property copier with specified json view- Parameters:
sourceGetter- source getter methodsetter- target setter methodconverter- converter functionviews- json view classes- Returns:
-