import static com.google.common.base.Preconditions.checkState;
import static java.lang.String.format;
-import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.base.Optional;
import com.google.common.collect.Collections2;
public class AbsModuleGeneratedObjectFactory {
- private static final Function<String, FullyQualifiedName> FULLY_QUALIFIED_NAME_FUNCTION = new Function<String, FullyQualifiedName>() {
- @Override
- public FullyQualifiedName apply(final String input) {
- return FullyQualifiedName.fromString(input);
- }
- };
-
public GeneratedObject toGeneratedObject(ModuleMXBeanEntry mbe, Optional<String> copyright) {
FullyQualifiedName abstractFQN = new FullyQualifiedName(mbe.getPackageName(), mbe.getAbstractModuleName());
Optional<String> classJavaDoc = Optional.fromNullable(mbe.getNullableDescription());
AbstractModuleTemplate abstractModuleTemplate = TemplateFactory.abstractModuleTemplateFromMbe(mbe);
Optional<String> header = abstractModuleTemplate.getHeaderString();
- List<FullyQualifiedName> implementedInterfaces = Lists.transform(abstractModuleTemplate.getTypeDeclaration().getImplemented(), FULLY_QUALIFIED_NAME_FUNCTION);
+ List<FullyQualifiedName> implementedInterfaces =
+ Lists.transform(abstractModuleTemplate.getTypeDeclaration().getImplemented(),
+ FullyQualifiedName::fromString);
Optional<FullyQualifiedName> extended =
Optional.fromNullable(
Iterables.getFirst(
- Collections2.transform(abstractModuleTemplate.getTypeDeclaration().getExtended(), FULLY_QUALIFIED_NAME_FUNCTION), null));
+ Collections2.transform(abstractModuleTemplate.getTypeDeclaration().getExtended(),
+ FullyQualifiedName::fromString), null));
Optional<FullyQualifiedName> maybeRegistratorType;
if (abstractModuleTemplate.isRuntime()) {