2828import importlib
2929from typing import Dict , List
3030
31+ CLASS_NAME_MAPPING = {
32+ "com.kelsoncm.fwf.columns.CharColumn" : "pyfwf.columns.CharColumn" ,
33+ "com.kelsoncm.fwf.columns.RightCharColumn" : "pyfwf.columns.RightCharColumn" ,
34+ "com.kelsoncm.fwf.columns.PositiveIntegerColumn" : "pyfwf.columns.PositiveIntegerColumn" ,
35+ "com.kelsoncm.fwf.columns.PositiveDecimalColumn" : "pyfwf.columns.PositiveDecimalColumn" ,
36+ "com.kelsoncm.fwf.columns.DateTimeColumn" : "pyfwf.columns.DateTimeColumn" ,
37+ "com.kelsoncm.fwf.columns.DateColumn" : "pyfwf.columns.DateColumn" ,
38+ "com.kelsoncm.fwf.columns.TimeColumn" : "pyfwf.columns.TimeColumn" ,
39+ "com.kelsoncm.fwf.descriptors.HeaderRowDescriptor" : "pyfwf.descriptors.HeaderRowDescriptor" ,
40+ "com.kelsoncm.fwf.descriptors.DetailRowDescriptor" : "pyfwf.descriptors.DetailRowDescriptor" ,
41+ "com.kelsoncm.fwf.descriptors.FooterRowDescriptor" : "pyfwf.descriptors.FooterRowDescriptor" ,
42+ "com.kelsoncm.fwf.descriptors.FileDescriptor" : "pyfwf.descriptors.FileDescriptor" ,
43+ "io.github.kelsoncm.fwf.columns.CharColumn" : "pyfwf.columns.CharColumn" ,
44+ "io.github.kelsoncm.fwf.columns.RightCharColumn" : "pyfwf.columns.RightCharColumn" ,
45+ "io.github.kelsoncm.fwf.columns.PositiveIntegerColumn" : "pyfwf.columns.PositiveIntegerColumn" ,
46+ "io.github.kelsoncm.fwf.columns.PositiveDecimalColumn" : "pyfwf.columns.PositiveDecimalColumn" ,
47+ "io.github.kelsoncm.fwf.columns.DateTimeColumn" : "pyfwf.columns.DateTimeColumn" ,
48+ "io.github.kelsoncm.fwf.columns.DateColumn" : "pyfwf.columns.DateColumn" ,
49+ "io.github.kelsoncm.fwf.columns.TimeColumn" : "pyfwf.columns.TimeColumn" ,
50+ "io.github.kelsoncm.fwf.descriptors.HeaderRowDescriptor" : "pyfwf.descriptors.HeaderRowDescriptor" ,
51+ "io.github.kelsoncm.fwf.descriptors.DetailRowDescriptor" : "pyfwf.descriptors.DetailRowDescriptor" ,
52+ "io.github.kelsoncm.fwf.descriptors.FooterRowDescriptor" : "pyfwf.descriptors.FooterRowDescriptor" ,
53+ "io.github.kelsoncm.fwf.descriptors.FileDescriptor" : "pyfwf.descriptors.FileDescriptor" ,
54+ }
55+
3156
3257def get_full_class_name (instance_or_class ):
3358 if isinstance (instance_or_class , type ):
@@ -37,6 +62,7 @@ def get_full_class_name(instance_or_class):
3762
3863
3964def create_class (full_class_name , * args , ** kwargs ):
65+ full_class_name = CLASS_NAME_MAPPING .get (full_class_name , full_class_name )
4066 module_name , class_name = full_class_name .rsplit ("." , 1 )
4167 MyClass = getattr (importlib .import_module (module_name ), class_name )
4268 return MyClass (* args , ** kwargs )
0 commit comments