All Questions
Tagged with parameterization java
24 questions
2
votes
1
answer
40
views
Rule for Cast operator validity when Interface held type is converted to a final class Type according to JLS
Consider the following clause of JLS 8 §5.5.1
Blockquote
If S is an interface type:
...
If T is a class type that is final, then:
...
– Otherwise, S is either a parameterized type that is an ...
3
votes
1
answer
481
views
Java Generic of Generic method
I wonder if it is possible to write a method that will handle casting of undefined types like:
Precondition:
Map<String, Object> map = new HashMap<>();
List<String> l = List.of("...
2
votes
2
answers
494
views
Maven param that contains spaces in jenkins declarative pipeline
Let's say that we have a jenkins pipeline that at some point we execute a maven parameterized build:
sh "mvn clean install -DparameterType=${parameter}"
What if the parameter's value ...
0
votes
1
answer
621
views
Random CSV Data Set Config
scenario: I have a script, which has around 14 transaction, out of which few are repeated transaction, so we have them in fragments. And we are using the random CSV data set config for ...
0
votes
1
answer
79
views
Test for parameterisation of a class
In my test I have this:
given:
def dueDateCol = App.instance.fxmlController.treeTableView.columns.get( 1 )
when:
def editorCell = dueDateCol.cellFactory.call( dueDateCol )
then:
editorCell ...
0
votes
1
answer
143
views
How to implement a generic interface where type param is Enum and some other type
I'm working with an interface that accepts a type parameter:
public interface Container<T>
Now I can have a class as such that implements it:
public class EnumContainer implements Container<...
0
votes
4
answers
2k
views
How to best parameterize a string
For example I have:
String templateString = "Hi {{customerName}}, you have successfully ordered a {{itemName}}."
Map<String, String> parameters = new HashMap<>();
parameters.put("...
0
votes
2
answers
256
views
How to instantiate a parameterized type class by name [duplicate]
Following Example:
I have a service that can 'start' any vehicle
interface VehicleStarterService<T: Vehicle> {
fun <T : Vehicle> start(vehicle: Class<T>): String {
return ...
1
vote
1
answer
3k
views
Using parameters from pom.xml to switch environments for selenium tests + using mvn command line arguments
My goal: using parameters to switch environments in my tests for instance:
mvn test google -> Tests goes to google site
mvn test bing -> bing site
"I need to feed my tests which environment is ...
1
vote
2
answers
40
views
Parameterizing Swing dialog
I need to create a number of dialogs that are of the same basic structure that looks like this:
There will be a varying number of rows, each with a labeled checkbox and two combo boxes that have ...
2
votes
1
answer
4k
views
Is it possible to create an instance of parameterized class in Java?
I have the same logic in classes creation, but actual classes are different. Is it possible somehow to create an instance of a parameterized class?
Here is an example:
public class MyClass <E ...
0
votes
1
answer
81
views
What is the correct way to override an interface method to ensure that it can only be used on objects of identical types?
I am creating a Matrix class in Java to use in a linear algebra program. Right now it holds doubles, but I want to abstract it.
I've created an interface called MatrixElement, which will contain add, ...
2
votes
0
answers
510
views
Mockito - spy of parameterized class calls mock method
I have been scratching my head a lot over something which just happened with Mockito.
I have this class, called ExamineFilter, which up to now has not been parameterised. 150+ tests to do with this ...
0
votes
1
answer
147
views
How to add dependency of one parameter type on another in Java generics
Suppose I have the following:
interface I {
// some getters and setters
}
class A implements I {
// some methods
}
class B implements I {
// some methods
}
interface J {
// some ...
1
vote
1
answer
916
views
Enter multiple data together in form using json data
[
{
"name": "Test",
"type": "Private",
"item":[{"itmeNo":"PT-15003C","quantity":"3"},
{"itmeNo":"PT-15003C","quantity":"3"}],
"successMsg":"Item(s) added to the job list."
}
]...