testdata.ClassWithVarArgs Maven / Gradle / Ivy
/*******************************************************************************
* Copyright (c) 2011 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package testdata;
import java.util.ArrayList;
import java.util.List;
import com.google.common.collect.Lists;
/**
* @author Sebastian Zarnekow - Initial contribution and API
*/
@SuppressWarnings("unused")
public class ClassWithVarArgs {
private boolean varArgConstructor;
private boolean defaultConstructor;
public ClassWithVarArgs() {
defaultConstructor = true;
}
public ClassWithVarArgs(int i, String... strings) {
this.varArgConstructor = true;
}
public ClassWithVarArgs(int i, String s1, String s2) {
this.varArgConstructor = false;
}
public List stringsToList(String... strings) {
if (strings == null)
return null;
return Lists.newArrayList(strings);
}
public List stringsToList2(String firstArg, String... strings) {
if (strings == null)
return null;
final ArrayList result = Lists.newArrayList(firstArg);
result.addAll(Lists.newArrayList(strings));
return result;
}
public List toList(T... args) {
return Lists.newArrayList(args);
}
public List toNumberList(T... args) {
return Lists.newArrayList(args);
}
public List stringsToList(String s1, String s2) {
return Lists.newArrayList("foo", s1, s2);
}
public boolean isVarArgConstructor() {
return varArgConstructor;
}
public boolean isDefaultConstructor() {
return defaultConstructor;
}
public String logInfo(String msg) {
return String.format("logInfo(%s)", msg);
}
public String logInfo(String msg, Object... args) {
return String.format("logInfo(%s, args...)", msg);
}
public String logInfo2(String msg) {
return String.format("logInfo2(%s)", msg);
}
public String logInfo2(String msg, String param1) {
return String.format("logInfo2(%s, %s)", msg, param1);
}
public String logInfo2(String msg, String param1, String param2) {
return String.format("logInfo2(%s, %s, %s)", msg, param1, param2);
}
public String logInfo2(String msg, Object... args) {
return String.format("logInfo2(%s, args...)", msg);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy