com.alphasystem.docbook.builder.impl.AbstractBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of docbook-2-docx Show documentation
Show all versions of docbook-2-docx Show documentation
Alpha system commons library
The newest version!
package com.alphasystem.docbook.builder.impl;
import com.alphasystem.commons.util.AppUtil;
import com.alphasystem.docbook.builder.Builder;
import com.alphasystem.docbook.builder.BuilderFactory;
import com.alphasystem.docbook.util.ConfigurationUtils;
import com.alphasystem.docbook.util.Utils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
import java.util.stream.Collectors;
public abstract class AbstractBuilder implements Builder {
protected final Logger logger = LoggerFactory.getLogger(getClass());
protected final ConfigurationUtils configurationUtils = ConfigurationUtils.getInstance();
protected final BuilderFactory builderFactory = BuilderFactory.getInstance();
protected String id;
protected String role;
protected Builder> parent;
protected S source;
private final String childContentMethodName;
protected AbstractBuilder(S source, Builder> parent) {
this("getContent", source, parent);
}
protected AbstractBuilder(String childContentMethodName, S source, Builder> parent) {
if (source == null) {
throw new NullPointerException(String.format("Source object is null in \"%s\"", getClass().getName()));
}
this.source = source;
this.parent = parent;
this.id = Utils.getId(source);
this.role = (String) AppUtil.invokeMethod(source, "getRole");
this.childContentMethodName = childContentMethodName;
}
public String getId() {
return id;
}
@Override
public Builder> getParent() {
return parent;
}
@Override
public S getSource() {
return source;
}
@Override
public List