我想阻止Jenkins节点在完成已经执行的那些作业后执行任何进一步的作业.
我怎么能这样做?我目前正在告诉Jenkins准备关机.这会错误地停止向所有节点分配新作业.
我有一个基本抽象类,有几个类扩展和覆盖它,但它们都有相同的构造函数.现在我从switch语句中调用每个构造函数:
case 1: return new A(arg1); // arg is int
Run Code Online (Sandbox Code Playgroud)
等,大约10个班级.是否有一种方法可以使用泛型或委托来创建一个方法来获取类名并使用参数实例化该类型?
这会有所帮助,因为如果我对构造函数进行更改,我还必须更改每个实例.
代表将是最直接的,但研究表明不会为代表分配构造函数.
附加:我现在使用笔记本电脑上网而不仅仅是我的手机,所以这里有一些代码.
这是现在发生的事情的一个例子:
switch (new Random().Next(4))
{
case 3:
// classA : baseClass, args{int, bool, otherClass}
return new classA(arg1, arg2, arg3);
case 2:
// classB : baseClass, args{int, bool, otherClass}
return new classB(arg1, arg2, arg3);
case 1:
// classC : baseClass, args{int, bool, otherClass}
return new classC(arg1, arg2, arg3);
case 0:
// classD : baseClass, args{int, bool, otherClass}
return new classD(arg1, arg2, arg3);
default:
continue;
}
Run Code Online (Sandbox Code Playgroud)
我想在块的末尾用三个参数调用一个实例化器.
我想到的一个解决方案是make和instantiator类与此类似: …
具有默认材质主题颜色(下面的代码)的简单可组合项会产生以下预览图像(在 IDE 中和设备上)
@Preview
@Composable
fun PreviewCalendar() {
MaterialTheme {
Column{
Row{Text("Hello World")}
Row{Button(onClick = {}){Text("Hello World Button")} }
}
}
}
Run Code Online (Sandbox Code Playgroud)
当提供我自己的颜色时,按钮变为空白(下面的代码和屏幕截图)。通读源代码,Button我希望按钮具有primary背景颜色。我是否错误地使用了颜色?我找不到类似行为的错误报告
val lightTheme =
Colors(
primary = Color(0x0d47a1),
primaryVariant = Color(0x5472d3),
secondary = Color(0x212121),
secondaryVariant = Color(0x484848),
background = Color(0xffffff),
surface = Color(0xffffff),
error = Color(0xB00020),
onPrimary = Color(0xffffff),
onSecondary = Color(0xffffff),
onBackground = Color(0x000000),
onSurface = Color(0x000000),
onError = Color(0xffffff),
isLight = true
)
@Preview
@Composable
fun PreviewCalendar() {
MaterialTheme(colors = lightTheme) { …Run Code Online (Sandbox Code Playgroud) android material-design android-jetpack android-jetpack-compose