I hereby claim:
- I am corneil on github.
- I am corneil (https://keybase.io/corneil) on keybase.
- I have a public key ASDB40W4Wve9epF06pwJoXAKLcK4H5ivgHUjJsOct3FAlAo
To claim this, I am signing this object:
import org.springframework.http.HttpStatus | |
import org.springframework.web.bind.annotation.ResponseStatus | |
import kotlin.contracts.ExperimentalContracts | |
import kotlin.contracts.contract | |
@ResponseStatus(HttpStatus.PRECONDITION_FAILED) | |
class PreconditionException(message: String) : Exception(message) | |
@ExperimentalContracts | |
@Throws(EntityNotFoundException::class) |
import org.junit.Assert.assertEquals | |
import org.junit.Test | |
import org.springframework.core.convert.TypeDescriptor | |
import org.springframework.expression.spel.SpelParserConfiguration | |
import org.springframework.expression.spel.standard.SpelExpressionParser | |
import org.springframework.expression.spel.support.SimpleEvaluationContext | |
class PropertyHolder(val properties: Map<String, Any>) | |
class SpelTests { |
inline fun <T> T.ifApply(expression: Boolean, block: T.() -> Unit, otherwise: T.() -> Unit) : T { | |
return if(expression) { | |
this.apply(block) | |
} else { | |
this.apply(otherwise) | |
} | |
} | |
inline fun <T> T.ifApply(expression: Boolean, block: T.() -> Unit) : T { | |
if(expression) { |
inline fun <K, V> Map<K, V>.getRequired(key: K): V = this.get(key) ?: throw IllegalArgumentException("$key not found in $keys") | |
fun main() { | |
val aMap = mapOf("a" to 1, "b" to 2, "c" to 3) | |
val anA = aMap.get("a") ?: error("a not found in ${aMap.keys}") | |
// while line reads easier | |
val guaranteedB = aMap.getRequired("b") | |
inline fun <T> T.ifZero(exp: Int, block: T.() -> Int): Int = if (exp == 0) block() else exp | |
// using | |
data class User( | |
val firstName: String, | |
val lastName: String, | |
val dateOfBirth: Date | |
) : Comparable<User> { | |
// classic comparator. |
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.neo4j.examples</groupId> | |
<artifactId>sdn5-movies</artifactId> | |
<version>0.0.1-SNAPSHOT</version> | |
<packaging>jar</packaging> |
I hereby claim:
To claim this, I am signing this object:
public Object getTarget() throws Exception { | |
MethodInvocation invocation = ExposeInvocationInterceptor.currentInvocation(); | |
return TransactionSynchronizationManager.getResource(invocation.getMethod()); // this call has different parameter. | |
} |
java.lang.NullPointerException | |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) | |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | |
at java.lang.reflect.Method.invoke(Method.java:498) | |
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) | |
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) | |
at com.sun.proxy.$Proxy148.getLockModeType(Unknown Source) | |
at org.springframework.data.jpa.repository.support.QueryDslJpaRepository.createQuery(QueryDslJpaRepository.java:180) | |
at org.springframework.data.jpa.repository.support.QueryDslJpaRepository.findAll(QueryDslJpaRepository.java:101) |
import groovy.io.FileType | |
def showOnly = true | |
def repoHome = new File(System.getProperty('user.home'), '.m2/repository') | |
def searchFolders = [] | |
args.each { arg -> | |
if(arg == '-s') { | |
showOnly = true | |
} else if(arg == '-d') { | |
showOnly = false | |
} else { |