net.moznion.sprint.AppendersBuilder Maven / Gradle / Ivy
package net.moznion.sprint;
import java.util.ArrayList;
import java.util.List;
class AppendersBuilder {
static List buildAppenders(final List terms) {
final List appenders = new ArrayList<>();
for (final TemplateTerm term : terms) {
final Appender appender;
if (term.isPlaceholder) {
appender = new Appender() {
@Override
public StringBuilder append(StringBuilder sb, Object obj) {
return sb.append(obj);
}
@Override
public boolean isPlaceholder() {
return true;
}
};
} else {
appender = new Appender() {
@Override
public StringBuilder append(StringBuilder sb, Object obj) {
return sb.append(term.content);
}
@Override
public boolean isPlaceholder() {
return false;
}
};
}
appenders.add(appender);
}
return appenders;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy