-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable ReflectionResolver to resolve map keys
This commit adds the functionality s.t. `ReflectionResolver` can resolve placeholders referencing map keys.
- Loading branch information
1 parent
ae20b83
commit 0d27dcb
Showing
8 changed files
with
124 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/com/docutools/jocument/MapPlaceholderData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.docutools.jocument; | ||
|
||
import java.util.Map; | ||
import java.util.stream.Stream; | ||
|
||
public record MapPlaceholderData(Map<String, PlaceholderData> map) | ||
implements PlaceholderData { | ||
|
||
@Override | ||
public PlaceholderType getType() { | ||
return PlaceholderType.MAP; | ||
} | ||
|
||
@Override | ||
public Stream<PlaceholderResolver> stream() { | ||
return map.values().stream().filter(placeholderData -> placeholderData.getType().equals(PlaceholderType.SET)).flatMap(PlaceholderData::stream); | ||
} | ||
|
||
@Override | ||
public long count() { | ||
return map.size(); | ||
} | ||
|
||
@Override | ||
public Object getRawValue() { | ||
return map; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters