public ParameterDetector(Parameter... parameters) throws RuntimeException {
        this.parameters = parameters;
        boolean canWarn=false;
        for (Parameter parameter : parameters) {
            if(parameter.isOptional())
            {
                canWarn=true;
            }
            else
            {
                if(canWarn) {
                	//a necessary precondition 
                	//because we can't be sure whether current param is optional or nonoptional without this condition
                    throw new RuntimeException("Optional parameters shouldn't come before NonOptional Perameters");
                }
            }
        }
    }