Search in sources :

Example 6 with CompoundPackageNameProcessor

use of com.palantir.conjure.python.processors.packagename.CompoundPackageNameProcessor in project conjure-python by palantir.

the class ConjurePythonGenerator method buildPackageNameProcessor.

private PackageNameProcessor buildPackageNameProcessor() {
    List<PackageNameProcessor> packageNameProcessors = new ArrayList<>();
    packageNameProcessors.add(new TwoComponentStrippingPackageNameProcessor());
    packageNameProcessors.addAll(config.pythonicPackageName().map(pythonPackageName -> ImmutableSet.of(new PrefixingPackageNameProcessor(pythonPackageName))).orElseGet(ImmutableSet::of));
    packageNameProcessors.add(FlatteningPackageNameProcessor.INSTANCE);
    return new CompoundPackageNameProcessor(packageNameProcessors);
}
Also used : ConstantPackageNameProcessor(com.palantir.conjure.python.processors.packagename.ConstantPackageNameProcessor) FlatteningPackageNameProcessor(com.palantir.conjure.python.processors.packagename.FlatteningPackageNameProcessor) PackageNameProcessor(com.palantir.conjure.python.processors.packagename.PackageNameProcessor) TwoComponentStrippingPackageNameProcessor(com.palantir.conjure.python.processors.packagename.TwoComponentStrippingPackageNameProcessor) PrefixingPackageNameProcessor(com.palantir.conjure.python.processors.packagename.PrefixingPackageNameProcessor) CompoundPackageNameProcessor(com.palantir.conjure.python.processors.packagename.CompoundPackageNameProcessor) PrefixingPackageNameProcessor(com.palantir.conjure.python.processors.packagename.PrefixingPackageNameProcessor) ArrayList(java.util.ArrayList) TwoComponentStrippingPackageNameProcessor(com.palantir.conjure.python.processors.packagename.TwoComponentStrippingPackageNameProcessor) CompoundPackageNameProcessor(com.palantir.conjure.python.processors.packagename.CompoundPackageNameProcessor)

Example 7 with CompoundPackageNameProcessor

use of com.palantir.conjure.python.processors.packagename.CompoundPackageNameProcessor in project conjure-python by palantir.

the class PackageNameProcessorTests method testFlatteningPackageNameProcessor.

@Test
public void testFlatteningPackageNameProcessor() {
    PackageNameProcessor processor = new CompoundPackageNameProcessor(ImmutableList.of(FlatteningPackageNameProcessor.INSTANCE));
    assertThat(processor.process("data.test.api")).isEqualTo("data_test_api");
}
Also used : PrefixingPackageNameProcessor(com.palantir.conjure.python.processors.packagename.PrefixingPackageNameProcessor) FlatteningPackageNameProcessor(com.palantir.conjure.python.processors.packagename.FlatteningPackageNameProcessor) PackageNameProcessor(com.palantir.conjure.python.processors.packagename.PackageNameProcessor) CompoundPackageNameProcessor(com.palantir.conjure.python.processors.packagename.CompoundPackageNameProcessor) TwoComponentStrippingPackageNameProcessor(com.palantir.conjure.python.processors.packagename.TwoComponentStrippingPackageNameProcessor) CompoundPackageNameProcessor(com.palantir.conjure.python.processors.packagename.CompoundPackageNameProcessor) Test(org.junit.Test)

Aggregations

CompoundPackageNameProcessor (com.palantir.conjure.python.processors.packagename.CompoundPackageNameProcessor)7 FlatteningPackageNameProcessor (com.palantir.conjure.python.processors.packagename.FlatteningPackageNameProcessor)7 PackageNameProcessor (com.palantir.conjure.python.processors.packagename.PackageNameProcessor)7 PrefixingPackageNameProcessor (com.palantir.conjure.python.processors.packagename.PrefixingPackageNameProcessor)7 TwoComponentStrippingPackageNameProcessor (com.palantir.conjure.python.processors.packagename.TwoComponentStrippingPackageNameProcessor)7 Test (org.junit.Test)5 ConstantPackageNameProcessor (com.palantir.conjure.python.processors.packagename.ConstantPackageNameProcessor)2 ArrayList (java.util.ArrayList)2 PythonFile (com.palantir.conjure.python.poet.PythonFile)1 PythonPackage (com.palantir.conjure.python.poet.PythonPackage)1 NameOnlyTypeNameProcessor (com.palantir.conjure.python.processors.typename.NameOnlyTypeNameProcessor)1 PackagePrependingTypeNameProcessor (com.palantir.conjure.python.processors.typename.PackagePrependingTypeNameProcessor)1 TypeNameProcessor (com.palantir.conjure.python.processors.typename.TypeNameProcessor)1 DealiasingTypeVisitor (com.palantir.conjure.visitor.DealiasingTypeVisitor)1