Skip to content

Interface Comparison and Interface Merging

ALexeyP0708 edited this page Jul 5, 2020 · 3 revisions

InterfaceManager.extendIntefaces

Generates interface rules and assembly class members. When inheriting interfaces, performs interface comparison.

Uses magic arguments (dynamically add arguments and depending on the type of argument its role will depend)

let Interfaces=[
	MyInterface1,
	MyInterface2
	MyInterface3
];
// way 1 
InterfaceManager.extendIntefaces (
	MyClass, // the class for which interface rules are generated. An interface may also be specified.
	false,  // - false (default) - interface comparison, true -  Interface Merging
	false, //  true - own properties will be created  according to descriptors  installed in the prototype chain.  false(dafult)
	...Interfaces // rest - Interfaces. 
);
	
// way 2 
InterfaceManager.extendIntefaces (
	MyClass, // the class for which interface rules are generated. An interface may also be specified.
	false,   // - false (default) - interface comparison, true -  Interface Merging
	...Interfaces // rest - Interfaces. 
)

// 3 вариант
InterfaceManager.extendIntefaces (
	MyClass, // the class for which interface rules are generated. An interface may also be specified.
	...Interfaces // rest - Interfaces. 
)

InterfaceManager.implementIntefaces

Generates interface rules, assembly of class members and subsequent class validation. Passing arguments is the same as with InterfaceManager.extendIntefaces For interfaces not applicable.

InterfaceManager.expandIntefaces

Generates interface rules and assembly of class members. When inheriting, implements interfaces merging.

//way 1
	let Interfaces=[
		MyInterface1,
		MyInterface2
		MyInterface3
	];
InterfaceManager.expandIntefaces(
	MyClass, // the class for which interface rules are generated. An interface may also be specified.
	false,//  true - own properties will be created  according to descriptors  installed in the prototype chain. false(default)
	...Interfaces // rest - Interfaces. 
	);
	
//2.вариант
InterfaceManager.expandIntefaces(
	MyClass, // the class for which interface rules are generated. An interface may also be specified.
	...Interfaces // rest - Interfaces. 
	)

Equivalent

let arguments=[
		arg,// [InterfaceClass] or [boolean]
		MyInterface2
		MyInterface3
	];
InterfaceManager.extendIntefaces(
	MyClass, 
	true,
	...arguments
	)