diff options
author | Yeongjong Lee <yj34.lee@samsung.com> | 2020-01-23 07:30:13 +0900 |
---|---|---|
committer | WooHyun Jung <wh0705.jung@samsung.com> | 2020-01-23 07:30:14 +0900 |
commit | 97098dcc50b62e51dad3469619ed55242ca01a80 (patch) | |
tree | 33d372fef1f883a12f4172ceb9ab07223ca28805 /src/bindings | |
parent | 5137f6d143c681fcf4f53e4e45df8af1a538ae75 (diff) | |
download | efl-97098dcc50b62e51dad3469619ed55242ca01a80.tar.gz |
csharp: cleanup concrete class
Summary:
Concrete class is only used to call static member of NativeMethod. they don't
need any inheritance and implementation of c functions.
Depends on D9893
Test Plan: ninja test
Reviewers: lauromoura, felipealmeida
Subscribers: Jaehyun_Cho, woohyun, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9894
Diffstat (limited to 'src/bindings')
-rw-r--r-- | src/bindings/mono/eina_mono/eina_container_common.cs | 24 | ||||
-rw-r--r-- | src/bindings/mono/eo_mono/iwrapper.cs | 12 |
2 files changed, 5 insertions, 31 deletions
diff --git a/src/bindings/mono/eina_mono/eina_container_common.cs b/src/bindings/mono/eina_mono/eina_container_common.cs index 192469a033..a07153e51a 100644 --- a/src/bindings/mono/eina_mono/eina_container_common.cs +++ b/src/bindings/mono/eina_mono/eina_container_common.cs @@ -1003,22 +1003,6 @@ internal static class TraitFunctions private static IDictionary<System.Type, object> register = new Dictionary<System.Type, object>(); - private static System.Type AsEflInstantiableType(System.Type type) - { - if (!IsEflObject(type)) - { - return null; - } - - if (type.IsInterface) - { - string fullName = type.FullName + "Concrete"; - return type.Assembly.GetType(fullName); // That was our best guess... - } - - return type; // Not interface, so it should be a concrete. - } - public static object RegisterTypeTraits<T>() { Eina.Log.Debug($"Finding TypeTraits for {typeof(T).Name}"); @@ -1026,14 +1010,6 @@ internal static class TraitFunctions var type = typeof(T); if (IsEflObject(type)) { - System.Type concrete = AsEflInstantiableType(type); - if (concrete == null || !type.IsAssignableFrom(concrete)) - { - throw new Exception("Failed to get a suitable concrete class for this type."); - } - - // No need to pass concrete as the traits class will use reflection to get the actually most - // derived type returned. traits = new EflObjectElementTraits<T>(); } else if (IsString(type)) diff --git a/src/bindings/mono/eo_mono/iwrapper.cs b/src/bindings/mono/eo_mono/iwrapper.cs index 780735fcca..ceae250bc9 100644 --- a/src/bindings/mono/eo_mono/iwrapper.cs +++ b/src/bindings/mono/eo_mono/iwrapper.cs @@ -1221,14 +1221,12 @@ internal static class ClassRegister if (objectType.IsInterface) { - // Try to get the *Concrete class - var assembly = objectType.Assembly; - objectType = assembly.GetType(objectType.FullName + "Concrete"); - - if (objectType == null) - { + // Try to get the *NativeMethods class + var nativeMethods = (Efl.Eo.NativeClass)System.Attribute.GetCustomAttributes(objectType)?.FirstOrDefault(attr => attr is Efl.Eo.NativeClass); + if (nativeMethods == null) return IntPtr.Zero; - } + + return nativeMethods.GetEflClass(); } var method = objectType.GetMethod("GetEflClassStatic", |