NewObject3

new_object(+Type, +Arguments, ?ObjectRef): constructs a new instance of Type (a it.unibo.tuprolog.solve.libs.oop.TypeRef, type-name atom, or $Alias expression) by invoking whichever public constructor best matches the Prolog list Arguments, unifying ObjectRef with an it.unibo.tuprolog.solve.libs.oop.ObjectRef wrapping the freshly created instance. See it.unibo.tuprolog.solve.libs.oop.rules.NewObject2 for the no-arguments new_object/2 sugar.

Example: new_object('java.util.ArrayList', [], L) creates an empty ArrayList.

Fails (rather than throwing) if Type is an atom naming a type that cannot be resolved.

Throws

if Type resolves to a type with no public constructor accepting Arguments.

if Type is neither a it.unibo.tuprolog.solve.libs.oop.TypeRef, a type-name atom, nor a $Alias expression, or Arguments is not a list.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard