A command about a MEntity

Introduced properties

private var _mentity: nullable MEntity

nitc :: CmdEntity :: _mentity

MEntity this command is about
private var _mentity_name: nullable String

nitc :: CmdEntity :: _mentity_name

Name of the mentity this command is about
init defaultinit(model: Model, filter: nullable ModelFilter, mentity: nullable MEntity, mentity_name: nullable String)

nitc :: CmdEntity :: defaultinit

fun init_mentity: CmdMessage

nitc :: CmdEntity :: init_mentity

Initialize the command mentity.
fun mentity: nullable MEntity

nitc :: CmdEntity :: mentity

MEntity this command is about
fun mentity=(mentity: nullable MEntity)

nitc :: CmdEntity :: mentity=

MEntity this command is about
fun mentity_name: nullable String

nitc :: CmdEntity :: mentity_name

Name of the mentity this command is about
fun mentity_name=(mentity_name: nullable String)

nitc :: CmdEntity :: mentity_name=

Name of the mentity this command is about

Redefined properties

redef type SELF: CmdEntity

nitc $ CmdEntity :: SELF

Type of this instance, automatically specialized in every class
redef fun http_init(req: HttpRequest): CmdMessage

nitc :: commands_http $ CmdEntity :: http_init

Init the command from an HTTPRequest
redef fun init_command: CmdMessage

nitc $ CmdEntity :: init_command

See init_mentity.
redef fun parser_init(mentity_name: String, options: CmdOptions): CmdMessage

nitc :: commands_parser $ CmdEntity :: parser_init

Initialize the command from the CommandParser data
redef fun to_html: Writable

nitc :: html_commands $ CmdEntity :: to_html

Render results as a HTML string
redef fun to_json: nullable Serializable

nitc :: json_commands $ CmdEntity :: to_json

Return a JSON Serializable representation of self results
redef fun to_md: Writable

nitc :: md_commands $ CmdEntity :: to_md

Render results as a Markdown string

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
private var _filter: nullable ModelFilter

nitc :: DocCommand :: _filter

ModelFilter to apply if any
private var _mentity: nullable MEntity

nitc :: CmdEntity :: _mentity

MEntity this command is about
private var _mentity_name: nullable String

nitc :: CmdEntity :: _mentity_name

Name of the mentity this command is about
private var _model: Model

nitc :: DocCommand :: _model

Model to retrieve data for
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
fun cmd_filter: ModelFilter

nitc :: DocCommand :: cmd_filter

Return a new filter for that command execution.
init defaultinit(model: Model, filter: nullable ModelFilter, mentity: nullable MEntity, mentity_name: nullable String)

nitc :: CmdEntity :: defaultinit

init defaultinit(model: Model, filter: nullable ModelFilter)

nitc :: DocCommand :: defaultinit

abstract fun execute(no_color: nullable Bool)

nitc :: DocCommand :: execute

fun filter: nullable ModelFilter

nitc :: DocCommand :: filter

ModelFilter to apply if any
protected fun filter=(filter: nullable ModelFilter)

nitc :: DocCommand :: filter=

ModelFilter to apply if any
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
fun http_init(req: HttpRequest): CmdMessage

nitc :: DocCommand :: http_init

Init the command from an HTTPRequest
init init

core :: Object :: init

fun init_command: CmdMessage

nitc :: DocCommand :: init_command

Initialize the command
fun init_mentity: CmdMessage

nitc :: CmdEntity :: init_mentity

Initialize the command mentity.
fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
fun mentity: nullable MEntity

nitc :: CmdEntity :: mentity

MEntity this command is about
fun mentity=(mentity: nullable MEntity)

nitc :: CmdEntity :: mentity=

MEntity this command is about
fun mentity_name: nullable String

nitc :: CmdEntity :: mentity_name

Name of the mentity this command is about
fun mentity_name=(mentity_name: nullable String)

nitc :: CmdEntity :: mentity_name=

Name of the mentity this command is about
fun model: Model

nitc :: DocCommand :: model

Model to retrieve data for
protected fun model=(model: Model)

nitc :: DocCommand :: model=

Model to retrieve data for
private intern fun native_class_name: CString

core :: Object :: native_class_name

The class name of the object in CString format.
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun parser_init(arg: String, options: CmdOptions): CmdMessage

nitc :: DocCommand :: parser_init

Initialize the command from the CommandParser data
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
fun to_html: Writable

nitc :: DocCommand :: to_html

Render results as a HTML string
abstract fun to_json: nullable Serializable

nitc :: DocCommand :: to_json

Return a JSON Serializable representation of self results
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_md: Writable

nitc :: DocCommand :: to_md

Render results as a Markdown string
fun to_s: String

core :: Object :: to_s

User readable representation of self.
package_diagram nitc::CmdEntity CmdEntity nitc::DocCommand DocCommand nitc::CmdEntity->nitc::DocCommand core::Object Object nitc::DocCommand->core::Object ...core::Object ... ...core::Object->core::Object nitc::CmdEntity... ... nitc::CmdEntity...->nitc::CmdEntity

Ancestors

interface Object

core :: Object

The root of the class hierarchy.

Parents

abstract class DocCommand

nitc :: DocCommand

Documentation command

Children

class CmdComment

nitc :: CmdComment

Retrieve the MDoc related to a MEntity
class CmdEntityCode

nitc :: CmdEntityCode

Cmd that finds the source code related to an mentity
abstract class CmdEntityFile

nitc :: CmdEntityFile

abstract class CmdEntityList

nitc :: CmdEntityList

A command about a MEntity that returns a list of mentities
class CmdInheritanceGraph

nitc :: CmdInheritanceGraph

Render a hierarchy graph for mentity if any.
abstract class CmdIni

nitc :: CmdIni

Cmd that finds the ini file related to an mentity
class CmdMainCompile

nitc :: CmdMainCompile

Cmd that finds the nitc command related to an mentity
class CmdManFile

nitc :: CmdManFile

Cmd that finds the man file related to an mentity
class CmdMetadata

nitc :: CmdMetadata

Retrieve the catalog metadata for a MPackage
class CmdUML

nitc :: CmdUML

UML command

Descendants

class CmdAllProps

nitc :: CmdAllProps

TODO remove once the filters/sorters are merged
class CmdAncestors

nitc :: CmdAncestors

MEntity ancestors command
class CmdCall

nitc :: CmdCall

Retrieve all the mproperties that call mentity
class CmdChildren

nitc :: CmdChildren

MEntity children command
class CmdContribFile

nitc :: CmdContribFile

Cmd that finds the contributing file related to an mentity
class CmdContribFileContent

nitc :: CmdContribFileContent

Cmd that finds the contrib file content related to an mentity
class CmdDescendants

nitc :: CmdDescendants

MEntity descendants command
class CmdFeatures

nitc :: CmdFeatures

MEntity feature list
abstract class CmdInheritance

nitc :: CmdInheritance

An abstract inheritance command
class CmdIniCloneCommand

nitc :: CmdIniCloneCommand

Cmd that finds the git clone command related to an mentity
class CmdIniContributors

nitc :: CmdIniContributors

Cmd that finds the contributors list of an mentity
class CmdIniDescription

nitc :: CmdIniDescription

Cmd that finds the ini description related to an mentity
class CmdIniGitUrl

nitc :: CmdIniGitUrl

Cmd that finds the clone url related to an mentity
class CmdIniIssuesUrl

nitc :: CmdIniIssuesUrl

Cmd that finds the issues link related to an mentity
class CmdIniLicense

nitc :: CmdIniLicense

Cmd that finds the license related to an mentity
class CmdIniMaintainer

nitc :: CmdIniMaintainer

Cmd that finds the maintainer name of an mentity
class CmdIntros

nitc :: CmdIntros

TODO remove once the filters/sorters are merged
class CmdLicenseFile

nitc :: CmdLicenseFile

Cmd that finds the license file related to an mentity
class CmdLicenseFileContent

nitc :: CmdLicenseFileContent

Cmd that finds the license file content related to an mentity
class CmdLinearization

nitc :: CmdLinearization

Linearization command
class CmdMains

nitc :: CmdMains

Cmd that finds the mains of an mentity
class CmdNew

nitc :: CmdNew

Retrieve all the mproperties that initialize mentity
class CmdParam

nitc :: CmdParam

Retrieve all the mproperties using mentity as a type for its parameters
class CmdParents

nitc :: CmdParents

MEntity parents command
class CmdRedefs

nitc :: CmdRedefs

TODO remove once the filters/sorters are merged
class CmdReturn

nitc :: CmdReturn

Retrieve all the mproperties that return somethinf of the mentity type.
class CmdSummary

nitc :: CmdSummary

Retrieve the MDoc summary
class CmdTesting

nitc :: CmdTesting

Cmd that finds the nitunit command related to an mentity

Class definitions

nitc $ CmdEntity
# A command about a MEntity
class CmdEntity
	super DocCommand

	# MEntity this command is about
	#
	# Alternatively you can provide a `mentity_name`.
	var mentity: nullable MEntity = null is optional, writable

	# Name of the mentity this command is about
	#
	# Alternatively you can directly provide the `mentity`.
	var mentity_name: nullable String = null is optional, writable

	# Initialize the command mentity.
	#
	# If not already set, tries to find the `mentity` from the `mentity_name`.
	#
	# This function try to match `mentity_name` both as a `full_name` and
	# `name`.
	#
	# Return states:
	# * `CmdSuccess`: everything was ok;
	# * `ErrorMEntityNoName`: no `mentity` and no `mentity_name` provided;
	# * `ErrorMEntityNotFound`: no mentity for `mentity_name`;
	# * `ErrorMEntityConflict`: `mentity_name` was a non-qualified name that
	#   returns more than one MEntity.
	fun init_mentity: CmdMessage do
		if mentity != null then
			if mentity_name == null then mentity_name = mentity.as(not null).full_name
			return new CmdSuccess
		end

		var mentity_name = self.mentity_name
		if mentity_name == null or mentity_name.is_empty then return new ErrorMEntityNoName

		mentity = model.mentity_by_full_name(mentity_name)
		if mentity == null then
			var mentities = model.mentities_by_name(mentity_name)
			if mentities.is_empty then
				var suggest = model.find(mentity_name, 3)
				return new ErrorMEntityNotFound(mentity_name, suggest)
			else if mentities.length > 1 then
				return new ErrorMEntityConflict(mentity_name, mentities)
			end
			mentity = mentities.first
		end
		return new CmdSuccess
	end

	# See `init_mentity`.
	redef fun init_command do return init_mentity
end
src/doc/commands/commands_base.nit:114,1--166,3

nitc :: commands_parser $ CmdEntity
redef class CmdEntity
	redef fun parser_init(mentity_name, options) do
		self.mentity_name = mentity_name
		return super
	end
end
src/doc/commands/commands_parser.nit:284,1--289,3

nitc :: commands_http $ CmdEntity
redef class CmdEntity
	redef fun http_init(req) do
		var name = req.param("id")
		if name != null then name = name.from_percent_encoding
		self.mentity_name = name

		return super
	end
end
src/doc/commands/commands_http.nit:58,1--66,3

nitc :: md_commands $ CmdEntity
redef class CmdEntity
	redef fun to_md do
		var mentity = self.mentity
		if mentity == null then return ""
		return "`{mentity.name}`"
	end
end
src/doc/templates/md_commands.nit:48,1--54,3

nitc :: json_commands $ CmdEntity
redef class CmdEntity
	redef fun to_json do return mentity
end
src/doc/templates/json_commands.nit:44,1--46,3

nitc :: html_commands $ CmdEntity
redef class CmdEntity
	redef fun to_html do
		var mentity = self.mentity
		if mentity == null then return ""
		return mentity.html_link.write_to_string
	end
end
src/doc/templates/html_commands.nit:51,1--57,3