Formatting.
This commit is contained in:
parent
13eaa7e7ea
commit
2ee300e420
4 changed files with 42 additions and 49 deletions
|
@ -309,17 +309,16 @@ public class HelenusSession extends AbstractSessionOperations implements Closeab
|
|||
int frame = 0;
|
||||
StackTraceElement[] trace = Thread.currentThread().getStackTrace();
|
||||
String targetClassName = HelenusSession.class.getName();
|
||||
do { frame++; } while (!trace[frame].getClassName().equals(targetClassName) && frame < trace.length);
|
||||
do { frame++; } while (trace[frame].getClassName().equals(targetClassName) && frame < trace.length);
|
||||
do {
|
||||
frame++;
|
||||
} while (!trace[frame].getClassName().equals(targetClassName) && frame < trace.length);
|
||||
do {
|
||||
frame++;
|
||||
} while (trace[frame].getClassName().equals(targetClassName) && frame < trace.length);
|
||||
if (frame < trace.length) {
|
||||
purpose = new StringBuilder().append(trace[frame].getClassName())
|
||||
.append(".")
|
||||
.append(trace[frame].getMethodName())
|
||||
.append("(")
|
||||
.append(trace[frame].getFileName())
|
||||
.append(":")
|
||||
.append(trace[frame].getLineNumber())
|
||||
.append(")");
|
||||
purpose = new StringBuilder().append(trace[frame].getClassName()).append(".")
|
||||
.append(trace[frame].getMethodName()).append("(").append(trace[frame].getFileName())
|
||||
.append(":").append(trace[frame].getLineNumber()).append(")");
|
||||
uow.setPurpose(purpose.toString());
|
||||
}
|
||||
}
|
||||
|
@ -329,7 +328,8 @@ public class HelenusSession extends AbstractSessionOperations implements Closeab
|
|||
return uow.begin();
|
||||
} catch (NoSuchMethodException | InvocationTargetException | InstantiationException
|
||||
| IllegalAccessException e) {
|
||||
throw new HelenusException(String.format("Unable to instantiate %s as a UnitOfWork.", unitOfWorkClass.getSimpleName()), e);
|
||||
throw new HelenusException(
|
||||
String.format("Unable to instantiate %s as a UnitOfWork.", unitOfWorkClass.getSimpleName()), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -692,7 +692,7 @@ public class HelenusSession extends AbstractSessionOperations implements Closeab
|
|||
execute(SchemaUtil.dropUserType(entity), true);
|
||||
break;
|
||||
|
||||
default:
|
||||
default :
|
||||
throw new HelenusException("Unknown entity type.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,11 +18,12 @@ package net.helenus.core.cache;
|
|||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.RemovalListener;
|
||||
import com.google.common.cache.RemovalNotification;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public interface SessionCache<K, V> {
|
||||
|
||||
|
@ -30,8 +31,7 @@ public interface SessionCache<K, V> {
|
|||
|
||||
static <K, V> SessionCache<K, V> defaultCache() {
|
||||
GuavaCache<K, V> cache;
|
||||
RemovalListener<K, V> listener =
|
||||
new RemovalListener<K, V>() {
|
||||
RemovalListener<K, V> listener = new RemovalListener<K, V>() {
|
||||
@Override
|
||||
public void onRemoval(RemovalNotification<K, V> n) {
|
||||
if (n.wasEvicted()) {
|
||||
|
@ -41,12 +41,8 @@ public interface SessionCache<K, V> {
|
|||
}
|
||||
};
|
||||
|
||||
cache = new GuavaCache<K, V>(CacheBuilder.newBuilder()
|
||||
.maximumSize(25_000)
|
||||
.expireAfterAccess(5, TimeUnit.MINUTES)
|
||||
.softValues()
|
||||
.removalListener(listener)
|
||||
.build());
|
||||
cache = new GuavaCache<K, V>(CacheBuilder.newBuilder().maximumSize(25_000)
|
||||
.expireAfterAccess(5, TimeUnit.MINUTES).softValues().removalListener(listener).build());
|
||||
|
||||
return cache;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.lang.reflect.Constructor;
|
|||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
@ -126,7 +125,7 @@ public class MapperInvocationHandler<E> implements InvocationHandler, Serializab
|
|||
}
|
||||
|
||||
if (MapExportable.TO_MAP_METHOD.equals(methodName)) {
|
||||
return src; //Collections.unmodifiableMap(src);
|
||||
return src; // Collections.unmodifiableMap(src);
|
||||
}
|
||||
|
||||
Object value = src.get(methodName);
|
||||
|
|
|
@ -39,6 +39,11 @@ public final class ValueProviderMap implements Map<String, Object> {
|
|||
this.immutable = entity.getMappingInterface().isAssignableFrom(Drafted.class);
|
||||
}
|
||||
|
||||
private static void throwShouldNeverCall(String methodName) {
|
||||
throw new HelenusMappingException(String.format(
|
||||
"the method %s should never be called on an instance of a Helenus ValueProviderMap", methodName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get(Object key) {
|
||||
if (key instanceof String) {
|
||||
|
@ -111,19 +116,12 @@ public final class ValueProviderMap implements Map<String, Object> {
|
|||
|
||||
@Override
|
||||
public Set<java.util.Map.Entry<String, Object>> entrySet() {
|
||||
return entity.getOrderedProperties()
|
||||
.stream()
|
||||
.map(p -> {
|
||||
return entity.getOrderedProperties().stream().map(p -> {
|
||||
return new ValueProviderMap.Entry<String, Object>(p.getPropertyName(),
|
||||
valueProvider.getColumnValue(source, -1, p, immutable));
|
||||
}).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
private static void throwShouldNeverCall(String methodName) {
|
||||
throw new HelenusMappingException(String.format(
|
||||
"the method %s should never be called on an instance of a Helenus ValueProviderMap", methodName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return source.toString();
|
||||
|
|
Loading…
Reference in a new issue