Exemplo n.º 1
0
    def get_class(self, classname):
        """
        Get a specific class object from class name

        Keyword arguments:
        classname -- the class name

        Returns:
        a mapped class instance for the class
        """
        clazz = self.protocol.getClass(classname)
        types = self.protocol.getTypes(clazz, [])
        if len(types) == 0:
            return None
        return Registry.resolve(types)(self, types, clazz, [])
Exemplo n.º 2
0
    def get_field(self, entry_point, path):
        """
        Get a specific field wrapped into an mapped class instance

        Keyword arguments:
        entry_point -- the object entry point
        path        -- path from the entry point to the object

        Returns:
        a mapped class instance for the object
        """
        if entry_point < 0:
            return None
        types = self.protocol.getTypes(entry_point, path)
        if len(types) == 0:
            return None
        return Registry.resolve(types)(self, types, entry_point, path)