change git root
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
}
|
||||
|
||||
group 'edu.msudenver.tsp'
|
||||
version '1.0'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
|
||||
sonarqube {
|
||||
properties {
|
||||
property "sonar.projectName", 'Parsing and Proofs Utilities'
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'lib', include: '**/*.jar')
|
||||
|
||||
testCompile group: 'junit', name: 'junit', version: '4.12'
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package edu.msudenver.tsp.utilities;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.BeanWrapper;
|
||||
import org.springframework.beans.BeanWrapperImpl;
|
||||
|
||||
import java.beans.FeatureDescriptor;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public abstract class PersistenceUtilities {
|
||||
|
||||
private static String[] getNullPropertyNames(final Object source) {
|
||||
final BeanWrapper wrappedSource = new BeanWrapperImpl(source);
|
||||
return Stream.of(wrappedSource.getPropertyDescriptors())
|
||||
.map(FeatureDescriptor::getName)
|
||||
.filter(propertyName -> wrappedSource.getPropertyValue(propertyName) == null
|
||||
|| propertyName.equals("id"))
|
||||
.toArray(String[]::new);
|
||||
}
|
||||
|
||||
public static void copyNonNullProperties(final Object source, final Object target) {
|
||||
BeanUtils.copyProperties(source, target, getNullPropertyNames(source));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user