Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonOellerer committed May 12, 2022
1 parent ed76c79 commit 9d930aa
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group 'com.docutools'
version = '1.4.0-rc.7'
version = '1.4.0-rc.9'

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/docutools/jocument/impl/DocumentImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
import org.apache.logging.log4j.Logger;

public abstract class DocumentImpl extends Thread implements Document {
public static final String GERMAN_SPECIAL_CHARACTERS = "ÄäÖöÜüß@";
public static final Pattern TAG_PATTERN = Pattern.compile("\\{\\{([A-Za-z0-9" + GERMAN_SPECIAL_CHARACTERS + "\\-/#.]+)}}");
public static final Pattern LOOP_END_PATTERN = Pattern.compile("\\{\\{/([A-Za-z0-9" + GERMAN_SPECIAL_CHARACTERS + "\\-/#.]+)}}");
public static final String GERMAN_SPECIAL_CHARACTERS = "ÄäÖöÜüß";
public static final Pattern TAG_PATTERN = Pattern.compile("\\{\\{([A-Za-z\\d" + GERMAN_SPECIAL_CHARACTERS + "@\\-/#.]+)}}");
public static final Pattern LOOP_END_PATTERN = Pattern.compile("\\{\\{/([A-Za-z\\d" + GERMAN_SPECIAL_CHARACTERS + "@\\-/#.]+)}}");
private static final Logger logger = LogManager.getLogger();
protected final Template template;
protected final PlaceholderResolver resolver;
Expand All @@ -29,7 +29,7 @@ public abstract class DocumentImpl extends Thread implements Document {
* @param resolver {@link PlaceholderResolver}
* @param options {@link GenerationOptions}
*/
public DocumentImpl(Template template, PlaceholderResolver resolver, GenerationOptions options) {
protected DocumentImpl(Template template, PlaceholderResolver resolver, GenerationOptions options) {
this.template = template;
this.resolver = resolver;
this.options = options;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public class PlaceholderMapperImpl implements PlaceholderMapper {
private static Map<String, String> placeholderMappings;
private static String pathString = System.getenv("DT_JT_RR_PLACEHOLDER_MAPPINGS");

public static void configure(String pathString2) {
pathString = pathString2;
public static void configure(String pathString) {
PlaceholderMapperImpl.pathString = pathString;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public class ReflectionResolver extends PlaceholderResolver {

private static final Logger logger = LogManager.getLogger();

protected final Object bean;
protected final CustomPlaceholderRegistry customPlaceholderRegistry;
private final Object bean;
private final CustomPlaceholderRegistry customPlaceholderRegistry;
private final PropertyUtilsBean pub = new PropertyUtilsBean();
private final PlaceholderMapper placeholderMapper = new PlaceholderMapperImpl();
private final PlaceholderResolver parent;
Expand Down Expand Up @@ -87,7 +87,7 @@ public ReflectionResolver(Object value,
}

/**
* Create a new reflection resolver with a parent registry.
* Create a new reflection resolver with no parent registry.
*
* @param value The value to resolve against
* @param customPlaceholderRegistry The custom placeholder registry to check for custom placeholders
Expand All @@ -99,7 +99,7 @@ public ReflectionResolver(Object value,
this(value, customPlaceholderRegistry, options, null);
}

protected static boolean isFieldAnnotatedWith(Class<?> clazz, String fieldName, Class<? extends Annotation> annotation) {
private static boolean isFieldAnnotatedWith(Class<?> clazz, String fieldName, Class<? extends Annotation> annotation) {
try {
return clazz.getDeclaredField(fieldName)
.getDeclaredAnnotation(annotation) != null;
Expand Down Expand Up @@ -430,14 +430,16 @@ private Object resolveNonFinalValue(Object property, String placeholderName)
logger.debug("Placeholder {} property is a future, getting it", placeholderName);
resolvedProperty = future.get(options.maximumWaitTime().toSeconds(), TimeUnit.SECONDS);
logger.debug("Placeholder {} property future retrieved", placeholderName);
resolvedProperty = resolveNonFinalValue(resolvedProperty, placeholderName);
}
if (resolvedProperty instanceof Optional<?> optional) {
if (property instanceof Optional<?> optional) {
logger.debug("Placeholder {} property is an optional, getting it", placeholderName);
if (optional.isEmpty()) {
throw new EmptyOptionalException(placeholderName);
} else {
resolvedProperty = optional.get();
logger.debug("Optional placeholder {} property contained {}", placeholderName, property);
resolvedProperty = resolveNonFinalValue(resolvedProperty, placeholderName);
}
}
return resolvedProperty;
Expand Down

0 comments on commit 9d930aa

Please sign in to comment.