Instead of throwing {@link NotExportableException} this method will return null
This should be used on hot paths where throwing the exception and catching it would incur a performance hit
@return model
@since 1.253
439010
@CheckForNull
    public <T> Model<T> getOrNull(Class<T> type, @CheckForNull Class<?> propertyOwner, @Nullable String property) {
        Model<T> m = models.get(type);
        if(m==null && type.getAnnotation(ExportedBean.class) != null) {
            m = new Model<T>(this, type, propertyOwner, property);
        }
        return m;
    }
443545
public function cliAction()
    {
        $exitCode = $this->cliApplication->run(new RequestInput($this->getRequest()), $this->output);

        if (is_numeric($exitCode)) {
            $model = new ViewModel();
            $model->setErrorLevel($exitCode);

            return $model;
        }
    }
1123337
protected function getModelReflection()
    {
        $modelClassName = str_replace('/', '\\', $this->input->getArgument('model'));

        try {
            $reflection = new ReflectionClass($this->getAppNamespace() . $modelClassName);
        } catch (\ReflectionException $e) {
            $reflection = new ReflectionClass($modelClassName);
        }

        if (!$reflection->isSubclassOf(Model::class) || !$reflection->isInstantiable()) {
            throw new NotAnInstanceOfException(sprintf('The model must be an instance of [%s]', Model::class));
        }

        return $reflection;
    }
1262601
public function getModel()
    {
        if ($this->_model === null) {
            $this->_model = Yii::createObject($this->modelClass);

            if (!$this->_model instanceof NgRestModelInterface) {
                throw new InvalidConfigException("The modelClass '$this->modelClass' must be an instance of NgRestModelInterface.");
            }
        }
    
        return $this->_model;
    }
179549
public function getModel()
    {
        $modelData = is_resource($this->model_data)
            ? stream_get_contents($this->model_data)
            : $this->model_data;

        $model = new $this->versionable_type();
        $model->unguard();
        $model->fill(unserialize($modelData));
        $model->exists = true;
        $model->reguard();
        return $model;
    }
676830
protected function createModel()
    {
        $model = $this->loader->getTracker()->getTrackModel();
        $model->applyFormatting(true, true);

        return $model;
    }
720902
protected function _validateLoadable() {
        if ($this->_loadable) {
            return true;
        }
        if (!class_exists('Model_Snippet')) {
            throw new Exception(
                'The Snippet model could not be autoloaded. Spawn it first, dumbass!'
            );
        }
        $this->_loadable = true;
        return $this->_loadable;
    }
138950
public T getAsObject() {
        try {
            T modelClassObj = modelClazz.newInstance();

            Set<String> columnNameSet = mFieldMap.keySet();

            for (String columnName : columnNameSet) {

                D6ModelClassFieldInfo fieldInfo = mFieldMap.get(columnName);

                final Field field = fieldInfo.field;

                final Object value = fieldInfo.value;

                if (value != null) {

                    // try to set 'null' if available
                    try {
                        field.set(modelClassObj, null);
                    } catch (Exception e) {
                    }

                    try {

                        field.set(modelClassObj, value);
                    } catch (IllegalAccessException e) {
                        // handling this exception for field.set(o, value);
                        loge("#getAsObject", e);
                    } catch (IllegalArgumentException e) {

                        // e.printStackTrace();
                        final String name = field.getName();
                        final Class<?> type = field.getType();

                        String msg = "The value of '" + columnName + "'=" + value + "(" + value.getClass() + ") couldn't set to variable '" + name + "'(" + type + ")";

                        loge("#getAsObject " + msg);

                    }
                } else {
                    // value is null

                    // check is this column CompositType like MySQL's Geometry
                    final List<Object> compositObjValues = fieldInfo.valuesForSpecialType;

                    if (field.getType() == org.riversun.d6.model.Geometry.class) {

                        if (compositObjValues != null && compositObjValues.size() > 1) {
                            final org.riversun.d6.model.Geometry newGeometryObj = new org.riversun.d6.model.Geometry();
                            newGeometryObj.x = (Double) compositObjValues.get(0);
                            newGeometryObj.y = (Double) compositObjValues.get(1);
                            field.set(modelClassObj, newGeometryObj);
                        }

                    }

                }

            }
            return modelClassObj;

        } catch (IllegalAccessException e) {
            throw new D6RuntimeException(e);
        } catch (InstantiationException e) {
            throw new D6RuntimeException("Cannot instanciate model object from '" + modelClazz.getName() + "' If you declare '" + modelClazz.getName() + "' as inner class, please make it static.");
        }

    }
113395
function () {
                var model;
                try {
                    model = this["__model__"] || (this["__model__"] = this.patio.getModel(this._model, this.parent.db));
                } catch (e) {
                    model = this["__model__"] = this.patio.getModel(this.name, this.parent.db);
                }
                return model;
            }
1250964
protected function modelFactory()
    {
        if ($this->modelFactory === null) {
            throw new Exception(sprintf(
                'Model Factory is not defined for "%s"',
                get_class($this)
            ));
        }

        return $this->modelFactory;
    }
946324
protected ModelListForm getModelListForm(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request) throws Exception {
		ModelListForm modelListForm = null;
		if (actionForm == null) {
			modelListForm = new ModelListForm();
			FormBeanUtil.saveActionForm(modelListForm, actionMapping, request);
		} else if (actionForm instanceof ModelListForm)
			modelListForm = (ModelListForm) actionForm;

		if (modelListForm == null)
			throw new Exception("not found the bean of com.jdon.strutsutil.ModelListForm");
		else
			return modelListForm;

	}
1200903
protected function getExportModel()
    {
        $model = parent::getExportModel();
        $model->del('parents', 'formatFunction');
        $model->del('allowed', 'formatFunction');
        $model->del('inherited', 'formatFunction');

        return $model;
    }
1057993
protected function getTableModel() {
		if ($this->_model === null) {
			$this->_model = $this->createTableModel();
		}
		
		return $this->_model;
	}
297216
public function tryLoadAny(Model $m)
    {
        $load = $m->action('select');
        $load->limit(1);

        // execute action
        try {
            $data = $this->typecastLoadRow($m, $load->getRow());
        } catch (\PDOException $e) {
            throw new Exception([
                'Unable to load due to query error',
                'query'      => $load->getDebugQuery(false),
                'model'      => $m,
                'conditions' => $m->conditions,
            ], null, $e);
        }

        if (!$data) {
            return;
        }

        if ($m->id_field) {

            // If id_field is not set, model will be read-only
            if (isset($data[$m->id_field])) {
                $m->id = $data[$m->id_field];
            } else {
                throw new Exception([
                    'Model uses "id_field" but it was not available in the database',
                    'model'       => $m,
                    'id_field'    => $m->id_field,
                    'data'        => $data,
                ]);
            }
        }

        return $data;
    }
1223048
public function export()
    {
        if (!$this->isXmlHttpRequest()) {
            throw new \Exception('Only ajax call allowed.');
        }

        if (!$this->hasRequestParameter(self::PARAMETER_DELIVERY_CLASS_URI) && !$this->hasRequestParameter(self::PARAMETER_DELIVERY_URI)) {
            throw new \common_Exception('Parameter "'. self::PARAMETER_DELIVERY_CLASS_URI .'" or "'. self::PARAMETER_DELIVERY_URI .'" missing');
        }

        $resourceUri = $this->hasRequestParameter(self::PARAMETER_DELIVERY_URI)
            ? \tao_helpers_Uri::decode($this->getRequestParameter(self::PARAMETER_DELIVERY_URI))
            : \tao_helpers_Uri::decode($this->getRequestParameter(self::PARAMETER_DELIVERY_CLASS_URI));

        /** @var ResultsExporter $exporter */
        $exporter = $this->propagate(new ResultsExporter($resourceUri, ResultsService::singleton()));

        return $this->returnTaskJson($exporter->createExportTask());
    }
427393
protected function getModel()
	{
		if (!$model = $this->owner) {
			throw new \Exception('Model is not been initialized properly.');
		}
		if (!$model instanceof ActiveRecord) {
			throw new \Exception(sprintf('Behavior must be applied to the ActiveRecord model class and it\'s iheritants, the unsupported class provided: `%s`', get_class($model)));
		}

		return $model;
	}
299775
public function getModel()
    {
        if(!$this->_model instanceof KModelInterface)
        {
            if(!($this->_model instanceof KObjectIdentifier)) {
                $this->setModel($this->_model);
            }

            $this->_model = $this->getObject($this->_model);

            if(!$this->_model instanceof KModelInterface)
            {
                throw new UnexpectedValueException(
                    'Model: '.get_class($this->_model).' does not implement KModelInterface'
                );
            }
        }

        return $this->_model;
    }