/*
 * @author Ranides Atterwim {@literal <ranides@gmail.com>}
 * @copyright Ranides Atterwim
 * @license WTFPL
 * @url http://ranides.net/projects/assira
 */

package net.ranides.assira.reflection.impl;

import net.ranides.assira.collection.query.CQuery;
import net.ranides.assira.reflection.IConstructor;
import net.ranides.assira.reflection.IConstructors;
import net.ranides.assira.reflection.IContext;
import net.ranides.assira.reflection.IHints;
import net.ranides.assira.text.StrBuilder;

import java.io.Serializable;

/**
 * Abstract base class for all IConstructor implementations.
 *
 * @param <T> T
 * @author Ranides Atterwim {@literal <ranides@gmail.com>}
 */
public abstract class AConstructor<T> extends AExecutable implements IConstructor<T>, Serializable {

    private static final long serialVersionUID = 1L;

    protected AConstructor() {
        this(IContext.getDefault());
    }

    protected AConstructor(IContext context) {
        super(context);
    }

	@Override
	public final IConstructors<T> collect() {
        return FElements.newConstructors(IHints.none(), CQuery.from().value(this));
	}

	@Override
    protected String[] $debugParams() {
        return CDParameters.getParams(reflective());
    }

    @Override
    public final String toString() {
        return new StrBuilder()
            .append(name())
            .open("(", ")",", ").append(arguments().list()).close()
            .toString();
    }
}
