本文整理汇总了Java中com.google.common.collect.ObjectArrays类的典型用法代码示例。如果您正苦于以下问题:Java ObjectArrays类的具体用法?Java ObjectArrays怎么用?Java ObjectArrays使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectArrays类属于com.google.common.collect包,在下文中一共展示了ObjectArrays类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import com.google.common.collect.ObjectArrays; //导入依赖的package包/类
public boolean run(String actionName, Profiler profiler,
String[] args) {
monitor.outcomeStarted(this, testClass.getName(), actionName);
String[] arguments = ObjectArrays.concat(testClass.getName(), args);
if (profile) {
arguments = ObjectArrays.concat("--debug", arguments);
}
try {
if (profiler != null) {
profiler.start();
}
new Runner().run(arguments);
} catch (Exception ex) {
ex.printStackTrace();
} finally {
if (profiler != null) {
profiler.stop();
}
}
monitor.outcomeFinished(Result.SUCCESS);
return true;
}
示例2: throwCause
import com.google.common.collect.ObjectArrays; //导入依赖的package包/类
private static Exception throwCause(Exception e, boolean combineStackTraces) throws Exception {
Throwable cause = e.getCause();
if (cause == null) {
throw e;
}
if (combineStackTraces) {
StackTraceElement[] combined =
ObjectArrays.concat(cause.getStackTrace(), e.getStackTrace(), StackTraceElement.class);
cause.setStackTrace(combined);
}
if (cause instanceof Exception) {
throw (Exception) cause;
}
if (cause instanceof Error) {
throw (Error) cause;
}
// The cause is a weird kind of Throwable, so throw the outer exception.
throw e;
}
示例3: prepareDataSourceContext
import com.google.common.collect.ObjectArrays; //导入依赖的package包/类
private static void prepareDataSourceContext(FlywayDataSourceContext dataSourceContext, Flyway flywayBean, FlywayTest annotation) throws Exception {
if (isAppendable(flywayBean, annotation)) {
dataSourceContext.reload(flywayBean);
} else {
String[] oldLocations = flywayBean.getLocations();
try {
if (annotation.overrideLocations()) {
flywayBean.setLocations(annotation.locationsForMigrate());
} else {
flywayBean.setLocations(ObjectArrays.concat(oldLocations, annotation.locationsForMigrate(), String.class));
}
dataSourceContext.reload(flywayBean);
} finally {
flywayBean.setLocations(oldLocations);
}
}
}
开发者ID:zonkyio,项目名称:embedded-database-spring-test,代码行数:18,代码来源:OptimizedFlywayTestExecutionListener.java
示例4: findModDirMods
import com.google.common.collect.ObjectArrays; //导入依赖的package包/类
public void findModDirMods(File modsDir, File[] supplementalModFileCandidates)
{
File[] modList = FileListHelper.sortFileList(modsDir, null);
modList = FileListHelper.sortFileList(ObjectArrays.concat(modList, supplementalModFileCandidates, File.class));
for (File modFile : modList)
{
// skip loaded coremods
if (CoreModManager.getIgnoredMods().contains(modFile.getName()))
{
FMLLog.finer("Skipping already parsed coremod or tweaker %s", modFile.getName());
}
else if (modFile.isDirectory())
{
FMLLog.fine("Found a candidate mod directory %s", modFile.getName());
addCandidate(new ModCandidate(modFile, modFile, ContainerType.DIR));
}
else
{
Matcher matcher = zipJar.matcher(modFile.getName());
if (matcher.matches())
{
FMLLog.fine("Found a candidate zip or jar file %s", matcher.group(0));
addCandidate(new ModCandidate(modFile, modFile, ContainerType.JAR));
}
else
{
FMLLog.fine("Ignoring unknown file %s in mods directory", modFile.getName());
}
}
}
}
示例5: parseArguments
import com.google.common.collect.ObjectArrays; //导入依赖的package包/类
@SuppressWarnings("MissingSuperCall")
@Override
protected Tool parseArguments(String[] args) {
commandName = Iterables.getFirst(arguments(args), Command.help.name());
commandArgs = removeFirst(commandName, args);
// Special behavior for help
if (options(args).contains("--help")) {
commandArgs = removeFirst("--help", ObjectArrays.concat(commandName, commandArgs));
commandName = Command.help.name();
args = removeFirst("--help", args);
}
// Display our version number and stop (note that commands can still override '--version')
if (options(args).contains("--version")
&& (commandName.equals(Command.help.name()) || isBefore("--version", commandName, args))) {
printVersion();
return doNothing();
}
// Do not delegate to the super, allow the commands to do the parsing
return this;
}
示例6: throwCause
import com.google.common.collect.ObjectArrays; //导入依赖的package包/类
private static Exception throwCause(Exception e, boolean combineStackTraces) throws Exception {
Throwable cause = e.getCause();
if (cause == null) {
throw e;
}
if (combineStackTraces) {
StackTraceElement[] combined = ObjectArrays.concat(cause.getStackTrace(), e.getStackTrace(), StackTraceElement.class);
cause.setStackTrace(combined);
}
if (cause instanceof Exception) {
throw (Exception) cause;
}
if (cause instanceof Error) {
throw (Error) cause;
}
// The cause is a weird kind of Throwable, so throw the outer exception.
throw e;
}
示例7: addModule
import com.google.common.collect.ObjectArrays; //导入依赖的package包/类
/**
* Add a new Module.
*
* @param module Module to add.
*/
public void addModule(Module module) throws DatabaseControllerException {
try {
//Notice: Changed order of values to avoid having to concat twice!
databaseConnector.executeSql("insert into "
+ DatabaseContract.ElectronicModule.TABLE_NAME + " ("
+ DatabaseContract.ElectronicModule.COLUMN_GPIO_PIN + ", "
+ DatabaseContract.ElectronicModule.COLUMN_USB_PORT + ", "
+ DatabaseContract.ElectronicModule.COLUMN_WLAN_PORT + ", "
+ DatabaseContract.ElectronicModule.COLUMN_WLAN_USERNAME + ", "
+ DatabaseContract.ElectronicModule.COLUMN_WLAN_PASSWORD + ", "
+ DatabaseContract.ElectronicModule.COLUMN_WLAN_IP + ", "
+ DatabaseContract.ElectronicModule.COLUMN_MODULE_TYPE + ", "
+ DatabaseContract.ElectronicModule.COLUMN_CONNECTOR_TYPE + ", "
+ DatabaseContract.ElectronicModule.COLUMN_SLAVE_ID + ", "
+ DatabaseContract.ElectronicModule.COLUMN_NAME + ") values "
+ "(?, ?, ?, ?, ?, ?, ?, ?, (" + DatabaseContract.SqlQueries.SLAVE_ID_FROM_FINGERPRINT_SQL_QUERY + "), ?)",
ObjectArrays.concat(
createCombinedModulesAccessInformationFromSingle(module.getModuleAccessPoint()),
new String[]{module.getModuleType().toString(), module.getModuleAccessPoint().getType(),
module.getAtSlave().getIDString(), module.getName()}, String.class));
} catch (SQLiteConstraintException sqlce) {
throw new DatabaseControllerException("The given Slave does not exist in the database"
+ " or the name is already used by another Module", sqlce);
}
}
示例8: getLatestRatingPageCount
import com.google.common.collect.ObjectArrays; //导入依赖的package包/类
public int getLatestRatingPageCount(int tenantId, int itemTypeId, Date since) {
final StringBuilder query = new StringBuilder("SELECT CEIL(count(*) / ?)");
query.append("\n");
query.append("FROM ").append(DEFAULT_TABLE_NAME).append("\n");
query.append("WHERE ");
query.append(DEFAULT_TENANT_COLUMN_NAME).append(" = ? AND ");
query.append(DEFAULT_ITEM_TYPE_COLUMN_NAME).append(" = ?");
Object[] args = new Object[]{PAGE_SIZE, tenantId, itemTypeId};
int[] argt = new int[]{Types.INTEGER, Types.INTEGER, Types.INTEGER};
if (since != null) {
query.append(" AND ").append(DEFAULT_ACTION_TIME_COLUMN_NAME).append(" > ?");
args = ObjectArrays.concat(args, since);
argt = Ints.concat(argt, new int[]{Types.TIMESTAMP});
}
int count = getJdbcTemplate().queryForInt(query.toString(), args, argt);
return count;
}
示例9: getRecommendationIteratorQueryString
import com.google.common.collect.ObjectArrays; //导入依赖的package包/类
protected String getRecommendationIteratorQueryString(TimeConstraintVO timeConstraints, ArgsAndTypesHolder holder) {
StringBuilder query = new StringBuilder("SELECT * FROM ");
query.append(DEFAULT_TABLE_NAME);
if (timeConstraints.getDateFrom() != null) {
query.append(" WHERE ");
query.append(DEFAULT_RECOMMENDATION_TIME_COLUMN_NAME);
query.append(" >= ?");
holder.getArgs()[0] = timeConstraints.getDateFrom();
if (timeConstraints.getDateTo() != null) {
query.append(" AND ");
query.append(DEFAULT_RECOMMENDATION_TIME_COLUMN_NAME);
query.append(" <= ?");
holder.setArgs(ObjectArrays.concat(holder.getArgs(), timeConstraints.getDateTo()));
holder.setArgTypes(Ints.concat(holder.getArgTypes(), new int[] { Types.TIMESTAMP }));
}
} else {
query.append(" WHERE ");
query.append(DEFAULT_RECOMMENDATION_TIME_COLUMN_NAME);
query.append(" <= ?");
holder.getArgs()[0] = timeConstraints.getDateTo();
}
return query.toString();
}
示例10: remove
import com.google.common.collect.ObjectArrays; //导入依赖的package包/类
/**
* Removes the first occurrence of a given value from an array, if it is present in the array.
* The array is assumed to be unordered.
*
* @param array
* to remove the value from; may be {@code null}
* @param value
* to remove; must not be {@code null}
* @return an array not containing the first occurrence of value, but containing all other elements of
* the original array. If the original array does not contain the given value, the returned
* array is == identical to the array passed in.
*/
public T[] remove(final T[] array, final T value) {
if (array == null) {
return null;
}
int i = find(array, value);
if (i == 0 && array.length == 1) {
return null;
}
if (i >= 0) {
// Found it: remove value. i is guaranteed to be < array.length here.
T[] newArray = ObjectArrays.newArray(componentType, array.length - 1);
if (i > 0) {
System.arraycopy(array, 0, newArray, 0, i);
}
if (i + 1 < array.length) {
System.arraycopy(array, i + 1, newArray, i, array.length - i - 1);
}
return newArray;
}
return array;
}
示例11: getOreData
import com.google.common.collect.ObjectArrays; //导入依赖的package包/类
private static OreSpawnData getOreData(String category, String type, String size, String blockName, int meta, int rarity, String[] rocks, int min, int max, int v, int h)
{
oresConfig = TFC_ConfigFiles.getOresConfig();
String[] ALLOWED_TYPES = new String[] { "default", "veins" };
String[] ALLOWED_SIZES = new String[] { "small", "medium", "large" };
String[] ALLOWED_BASE_ROCKS = ObjectArrays.concat(Global.STONE_ALL, new String[] { "igneous intrusive", "igneous extrusive", "sedimentary", "metamorphic" }, String.class);
return new OreSpawnData(
oresConfig.get(category, "type", type).setValidValues(ALLOWED_TYPES).getString(),
oresConfig.get(category, "size", size).setValidValues(ALLOWED_SIZES).getString(),
oresConfig.get(category, "oreName", blockName).getString(),
oresConfig.get(category, "oreMeta", meta).getInt(),
oresConfig.get(category, "rarity", rarity).getInt(),
oresConfig.get(category, "baseRocks", rocks).setValidValues(ALLOWED_BASE_ROCKS).getStringList(),
oresConfig.get(category, "Minimum Height", min).getInt(),
oresConfig.get(category, "Maximum Height", max).getInt(),
oresConfig.get(category, "Vertical Density", v).getInt(),
oresConfig.get(category, "Horizontal Density", h).getInt()
);
}
示例12: unlinkCommits
import com.google.common.collect.ObjectArrays; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void unlinkCommits(Repository domain, RepositoryPullRequestMapping request, Iterable<? extends RepositoryCommitMapping> commits)
{
Iterable<Integer> commitIds = Iterables.transform(commits, new Function<RepositoryCommitMapping, Integer>()
{
@Override
public Integer apply(final RepositoryCommitMapping repositoryCommitMapping)
{
return repositoryCommitMapping.getID();
}
});
final String baseWhereClause = ActiveObjectsUtils.renderListOperator(RepositoryPullRequestToCommitMapping.COMMIT, "IN", "OR", commitIds);
Query query = Query.select().where(RepositoryPullRequestToCommitMapping.REQUEST_ID + " = ? AND "
+ baseWhereClause, ObjectArrays.concat(request.getID(), Iterables.toArray(commitIds, Object.class)));
ActiveObjectsUtils.delete(activeObjects, RepositoryPullRequestToCommitMapping.class, query);
}
示例13: getByIssueKeys
import com.google.common.collect.ObjectArrays; //导入依赖的package包/类
@Override
public List<RepositoryPullRequestMapping> getByIssueKeys(final Iterable<String> issueKeys)
{
Collection<Integer> prIds = findRelatedPullRequests(issueKeys);
if (prIds.isEmpty())
{
return Lists.newArrayList();
}
final String whereClause = ActiveObjectsUtils.renderListOperator("pr.ID", "IN", "OR", prIds).toString();
final Object [] params = ObjectArrays.concat(new Object[]{Boolean.FALSE, Boolean.TRUE}, prIds.toArray(), Object.class);
Query select = Query.select()
.alias(RepositoryMapping.class, "repo")
.alias(RepositoryPullRequestMapping.class, "pr")
.join(RepositoryMapping.class, "repo.ID = pr." + RepositoryPullRequestMapping.TO_REPO_ID)
.where("repo." + RepositoryMapping.DELETED + " = ? AND repo." + RepositoryMapping.LINKED + " = ? AND " + whereClause, params);
return Arrays.asList(activeObjects.find(RepositoryPullRequestMapping.class, select));
}
示例14: throwCause
import com.google.common.collect.ObjectArrays; //导入依赖的package包/类
private static Exception throwCause(Exception e, boolean combineStackTraces)
throws Exception {
Throwable cause = e.getCause();
if (cause == null) {
throw e;
}
if (combineStackTraces) {
StackTraceElement[] combined = ObjectArrays.concat(cause.getStackTrace(),
e.getStackTrace(), StackTraceElement.class);
cause.setStackTrace(combined);
}
if (cause instanceof Exception) {
throw (Exception) cause;
}
if (cause instanceof Error) {
throw (Error) cause;
}
// The cause is a weird kind of Throwable, so throw the outer exception.
throw e;
}
示例15: addOrgUser
import com.google.common.collect.ObjectArrays; //导入依赖的package包/类
@Override
public Optional<User> addOrgUser(UserRequest userRequest, UUID orgGuid, String currentUser) {
Optional<UserIdNamePair> idNamePair = uaaClient.findUserIdByName(userRequest.getUsername());
if(!idNamePair.isPresent()) {
inviteUserToOrg(userRequest.getUsername(), currentUser, orgGuid,
ImmutableSet.<Role>builder()
.addAll(userRequest.getRoles())
.add(Role.USERS)
.build());
}
return idNamePair.map(pair -> {
UUID userGuid = pair.getGuid();
Role[] roles = ObjectArrays
.concat(userRequest.getRoles().toArray(new Role[]{}), Role.USERS);
assignOrgRolesToUser(userGuid, orgGuid, roles);
return new User(userRequest.getUsername(), userGuid, userRequest.getRoles(), orgGuid);
});
}