Skip to content

Commit

Permalink
Improves serialization of Title instances.
Browse files Browse the repository at this point in the history
  • Loading branch information
hzafar committed Jan 14, 2021
1 parent b3b0963 commit 1cc7ea1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ java {
}

dokka {
outputFormat = 'html'
outputFormat = 'html-as-java'
outputDirectory = "$buildDir/dokka"
}

task javadocJar(type: Jar) {
archiveClassifier = 'javadoc'
dependsOn dokka
from("$buildDir/dokka/isbd-parser")
from("$buildDir/dokka/style.css")
from("$buildDir/dokka/")
}

publishing {
Expand Down Expand Up @@ -95,6 +94,7 @@ repositories {

dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.12.1'
api 'com.github.norswap:autumn:80abd5c207'
testImplementation 'junit:junit:4.12'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class TitleStatementParser : TitleStatementGrammar() {
return result.value_stack.mapNotNull { it as TitleStatement }
}

throw Exception(result.toString())
return emptyList()
}

/** Produces all possible parses of the given title statement string.
Expand Down
11 changes: 10 additions & 1 deletion src/main/kotlin/ca/voidstarzero/isbd/titlestatement/ast/Title.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
package ca.voidstarzero.isbd.titlestatement.ast

import com.fasterxml.jackson.annotation.JsonTypeInfo

/**
* Base class for titles.
*/
sealed class Title() : Node() {}
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.EXISTING_PROPERTY,
property = "type"
)
sealed class Title() : Node() {
val type = this::class.java.simpleName
}

/**
* A class holding the title part of a title statement.
Expand Down

0 comments on commit 1cc7ea1

Please sign in to comment.