Skip to content

Commit 76238eb

Browse files
committed
update readme and changelog
1 parent 557ebf1 commit 76238eb

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.1.5] - 2025-10-06
9+
10+
### Added
11+
- Added `JavaFile.add_additional_imports(str)` to always add specific imports regardless of usage.
12+
- Allows for wildcard imports too (e.g., `java.util.*`).
13+
814
## [0.1.4] - 2025-08-07
915

1016
### Added

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ print(str(java_file))
10061006
# Java file with imports and file comment
10071007
java_file_with_imports = JavaFile.builder("com.example", simple_class) \
10081008
.add_file_comment_line("This is a generated file.") \
1009-
.add_file_comment_line("Do not edit manually.") \
1009+
.add_file_comment_line("Do not edit manually.") \
10101010
.add_static_import(ClassName.get("java.lang", "System"), "out") \
10111011
.build()
10121012
print(str(java_file_with_imports))
@@ -1021,6 +1021,21 @@ print(str(java_file_with_imports))
10211021
#
10221022
# public class HelloWorld {
10231023
# }
1024+
1025+
# Java file with additional imports (always outputted)
1026+
# Note: wildcard will override any usage in prefix path
1027+
java_file_with_additional_imports = JavaFile.builder("com.example", simple_class) \
1028+
.add_additional_import("java.util.Collections") \
1029+
.add_additional_import("java.lang.*") \
1030+
.build()
1031+
# Output:
1032+
# package com.example;
1033+
#
1034+
# import java.lang.*;
1035+
# import java.util.Collections
1036+
#
1037+
# public class HelloWorld {
1038+
# }
10241039
```
10251040

10261041
### Builder Pattern Methods

0 commit comments

Comments
 (0)