Questions tagged [named-parameters]

Named parameters enable you to specify an argument for a particular parameter by associating the argument with the parameter's name rather than with the parameter's position in the parameter list.

371 questions
1
vote
3 answers

How to pass default for named parameters in javascript

I have a method in typescript as below using named parameters public foo({x, y, z , m , n} : {x:string, y: number, z: number, m?:string, n?:number}) { } parameters m and n will be provided from another object like const default = { m : 'M', n :10,…
Reza
  • 18,865
  • 13
  • 88
  • 163
1
vote
0 answers

Building Named parameter support for Java

I was thinking of building a tool through which we can have Named Parameters in Java 8+. I am looking for approaches on how to move forward with this. Here's what I have thought of so far, Writing a compiler plugin which rewrites the method…
Adwait Kumar
  • 1,552
  • 10
  • 25
1
vote
1 answer

Oracle Stored Procedure JDBC call with named paramaters fails with 'Found Symbol >'

I got this Oracle stored procedure code calling another stored procedure: PROCEDURE xyz_main ( i_param_a IN VARCHAR2 DEFAULT 'Y', i_param_b IN PERSON.NAME%TYPE i_param_c IN VARCHAR2 DEFAULT 'BLA' o_return_msg OUT VARCHAR2 ) IS ... BEGIN …
Rainer
  • 1,067
  • 2
  • 14
  • 29
1
vote
1 answer

Dart Abstract Class Method with @required optimal parameters

How to use @required annotion in abstract class? There is no error on SubjectVM.dart. I want it to be @required automatic import 'package:flutter/material.dart'; import 'package:todo/models/subject.dart'; abstract class SubjectBase { void…
763
  • 1,543
  • 1
  • 12
  • 15
1
vote
1 answer

Pass named parameter to a method

Code: class AllTheColorsOfTheRainbow { private int hue = 0; int anIntegerRepresentingColors; void changeTheHueOfTheColor(int newHue) { this.hue = newHue; } public int getHue(){ return this.hue; …
Michael
  • 4,273
  • 3
  • 40
  • 69
1
vote
1 answer

IllegalArgumentException: Could not locate named parameter

I pass a Map as parameter of the following method: public List getByParameterOrAll(Map paramsMap) { String email = null; String emailValue = null; String phone = null; String phoneValue = null; …
Jelly
  • 972
  • 1
  • 17
  • 40
1
vote
2 answers

Named parameter not replaced inside single quotation marks

I'm trying to use a named parameter but when I have them inside of single quotation marks they don't get replaced for the query and it returns 0 results. How do I use my parameter inside the single quotation marks? protected static final String…
Icy Creature
  • 1,875
  • 2
  • 28
  • 53
1
vote
1 answer

Constructor parameter naming for clarity with passing in anonymous methods

I'm interested in the readability of my code when passing anonymous methods into delegate parameters: var touchListener = new TouchListener( down:(v, e) => { //Handle the down…
1
vote
1 answer

How to set default lambda function for named lambda argument with generics in Kotlin?

This code prints "Hello 1". parseInput have two generic types, the first arg is a simple object of the first generic type A, the second arg is a function which suppose to change the generic type A to generic B. As you can see it works fine in the…
s-hunter
  • 24,172
  • 16
  • 88
  • 130
1
vote
2 answers

MS Access, Named parameters and Column Names

I have the following query which I am executing on an Access database. The query, when run in Access returns accurate results. However when run from the code I get back all of the items in the database, even those which fall outside the date range I…
Aran Mulholland
  • 23,555
  • 29
  • 141
  • 228
1
vote
2 answers

Scala - Mock a method that receives a call-by-name parameter

Assume I have the following trait, with a single method that receives a call-by-name parameter: trait Client { def compute(value: => String): String } Also, assume I have the following function: final def getValue: String = { "value" } Now…
Amit Pe'er
  • 173
  • 1
  • 12
1
vote
1 answer

How to init a `HashTable` object which use named parameters?

We can init a HashTable object using the below syntax. var listTinhThanh = new System.Collections.Hashtable() { { "key", someObject } }; I want to use the code in such a manner of: var listTinhThanh = new System.Collections.Hashtable() { …
Nam G VU
  • 33,193
  • 69
  • 233
  • 372
1
vote
3 answers

JavaScript custom arguments in constructor

I work with JavaScript (ECMAScript 5). I have a class like this: My class function elementClass(htmlType, cssClass, text, value, id) { this.htmlType = htmlType; this.cssClass = cssClass; this.text = text; this.value = value; …
Ali Soltani
  • 9,589
  • 5
  • 30
  • 55
1
vote
1 answer

Scala named argument: recursive call

Very strange situation. I have the following code snippet: case class SomeResponse( ok: Boolean, result: Seq[Data] ) class TestContainer { def testMethod() = { val response = SomeResponse( // vvv - issue is…
Andrii Abramov
  • 10,019
  • 9
  • 74
  • 96
1
vote
1 answer

How to pass a (*args,**kwargs) type of attribute to a function within class?

I want to create a module for a custom plot drawing for my scientific data, but I do not know how to pass an argument of type (*arg2,**kwarg2) to a method. Here is the relevant code: import numpy as np import matplotlib.pyplot as plt # class of…
Maria
  • 84
  • 4
  • 9