typeshare_java/
config.rs

1use std::collections::HashMap;
2
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Serialize, Deserialize)]
6#[serde(default)]
7pub struct JavaConfig {
8    /// The header comment to prepend to generated files
9    pub header_comment: HeaderComment,
10    /// Name of the Java package
11    pub package: Option<String>,
12    /// The prefix to append to user-defined types
13    pub prefix: Option<String>,
14    /// Conversions from Rust type names to Java type names
15    pub type_mappings: HashMap<String, String>,
16    /// Whether generated Java classes should be wrapped in a namespace class
17    pub namespace_class: bool,
18}
19
20impl Default for JavaConfig {
21    fn default() -> Self {
22        Self {
23            header_comment: HeaderComment::None,
24            package: None,
25            prefix: None,
26            type_mappings: HashMap::with_capacity(0),
27            namespace_class: true,
28        }
29    }
30}
31
32#[derive(Debug, Serialize, Deserialize)]
33#[serde(tag = "type")]
34pub enum HeaderComment {
35    None,
36    Custom { comment: String },
37    Default,
38}