Skip to content

Instantly share code, notes, and snippets.

@h4t0n
h4t0n / ExceptionHandlerExample.java
Created December 9, 2018 11:37
[GEMINI] ExceptionHandlerExample
@ExceptionHandler(EntityRecordException.class)
public ResponseEntity<?> handleEntityFoundException(EntityRecordException exception) {
HttpStatus httpStatus = HttpStatus.INTERNAL_SERVER_ERROR;
switch (exception.getErrorCode()) {
case MULTIPLE_LK_FOUND:
httpStatus = HttpStatus.CONFLICT;
break;
case LK_NOTFOUND:
case INSERTED_RECORD_NOT_FOUND:
httpStatus = HttpStatus.NOT_FOUND;
public class Lexer {
private StreamTokenizer input;
public enum TokenType {
INTERFACE("INTERFACE"),
ENTITY("ENTITY"),
EMBEDABLE("EMBEDABLE"),
IMPLEMENTS("IMPLEMENTS"),
L_BRACE("{"),
R_BRACE("}"),
public class SchemaParser {
private Lexer lexer;
private TokenType currentToken;
public SchemaParser(Reader r) {
lexer = new Lexer(r);
}
private RawSchema parse() throws SyntaxError {
RawSchemaBuilder rawSchemaBuilder = new RawSchemaBuilder();
# file name must be .travis.yml
language: java
jdk: openjdk10
before_install:
- wget http://services.gradle.org/distributions/gradle-5.4.1-bin.zip
- unzip -qq gradle-5.4.1-bin.zip
- export GRADLE_HOME=$PWD/gradle-5.4.1
- export PATH=$GRADLE_HOME/bin:$PATH
- gradle -v