Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Commit

Permalink
Add java-class-prefix option to djinni
Browse files Browse the repository at this point in the history
java-class-prefix will prefix all Java class names with passed prefix
when generating output.
  • Loading branch information
izacus committed Apr 29, 2016
1 parent fe2fd05 commit cc2294f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/source/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ object Main {
var javaNullableAnnotation: Option[String] = None
var javaNonnullAnnotation: Option[String] = None
var javaUseFinalForRecord: Boolean = true
var javaClassPrefix: Option[String] = None
var jniOutFolder: Option[File] = None
var jniHeaderOutFolderOptional: Option[File] = None
var jniNamespace: String = "djinni_generated"
Expand Down Expand Up @@ -98,6 +99,8 @@ object Main {
.text("The output for the Java files (Generator disabled if unspecified).")
opt[String]("java-package").valueName("...").foreach(x => javaPackage = Some(x))
.text("The package name to use for generated Java classes.")
opt[String]("java-class-prefix").valueName("<prefix>").foreach(x => javaClassPrefix = Some(x))
.text("The prefix to be prepended to generated Java class names.")
opt[String]("java-cpp-exception").valueName("<exception-class>").foreach(x => javaCppException = Some(x))
.text("The type for translated C++ exceptions in Java (default: java.lang.RuntimeException that is not checked)")
opt[String]("java-annotation").valueName("<annotation-class>").foreach(x => javaAnnotation = Some(x))
Expand Down Expand Up @@ -224,6 +227,11 @@ object Main {
var objcFileIdentStyle = objcFileIdentStyleOptional.getOrElse(objcIdentStyle.ty)
val objcppIncludeObjcPrefix = objcppIncludeObjcPrefixOptional.getOrElse(objcppIncludePrefix)

// Add Java prefix to identstyle
if (javaClassPrefix.isDefined) {
javaIdentStyle = javaIdentStyle.copy(ty = IdentStyle.prefix(javaClassPrefix.get, javaIdentStyle.ty))
}

// Add ObjC prefix to identstyle
objcIdentStyle = objcIdentStyle.copy(ty = IdentStyle.prefix(objcTypePrefix,objcIdentStyle.ty))
objcFileIdentStyle = IdentStyle.prefix(objcTypePrefix, objcFileIdentStyle)
Expand Down

0 comments on commit cc2294f

Please sign in to comment.