public CoordinatorParameters setSessionId(String sessionId) { this.sessionId = checkNotNull(sessionId, "sessionId can't be null"); return this; }
public MetronomeBuilder withMetronomeType(MetronomeType type) { this.type = checkNotNull(type, "type cant be null"); return this; }
public EmbeddedScriptCommand setEngineName(String engineName) { this.engineName = checkNotNull(engineName, "engineName can't be null"); return this; }
public BashCommand setDirectory(File directory) { this.directory = checkNotNull(directory, "directory can't be null"); return this; }
public AnnotatedMethodRetriever(Class clazz, Class<? extends Annotation> annotationClazz) { this.clazz = checkNotNull(clazz, "clazz can't be null"); this.annotationClazz = checkNotNull(annotationClazz, "annotationClazz can't be null"); }
public void setAgentWorkerMode(AgentWorkerMode agentWorkerMode) { this.agentWorkerMode = checkNotNull(agentWorkerMode, "agentWorkerMode can't be null"); }
ComputeServiceBuilder(SimulatorProperties properties) { this.properties = Preconditions.checkNotNull(properties, "properties can't be null"); }
public ConfigFileTemplate(String rawTemplate) { this.rawTemplate = checkNotNull(rawTemplate, "rawTemplate can't be null"); }
public WorkerType(String name) { this.name = checkNotNull(name, "name can't be null"); }
public void setId(String id) { this.id = checkNotNull(id, "id can't be null"); }
public AgentData(int addressIndex, String publicAddress, String privateAddress, Map<String, String> tags) { if (addressIndex <= 0) { throw new IllegalArgumentException("addressIndex must be a positive number"); } this.addressIndex = addressIndex; this.address = new SimulatorAddress(AddressLevel.AGENT, addressIndex, 0, 0); this.publicAddress = checkNotNull(publicAddress, "publicAddress can't be null"); this.privateAddress = checkNotNull(privateAddress, "privateAddress can't be null"); this.tags = checkNotNull(tags, "tags can't be null"); }
public TestCase(String id, Map<String, String> properties) { this.id = checkNotNull(id, "id can't be null"); for (Map.Entry<String, String> entry : properties.entrySet()) { setProperty(entry.getKey(), entry.getValue()); } }
@Override public K load(final K key) { checkNotNull(key, "load null key!"); if (loadDelayMs > 0) { sleepMillis(loadDelayMs); } loaded.put(key, key); loadCount.incrementAndGet(); return key; }
public String load(String property) { checkNotNull(property, "propertyName can't be null"); String value = testCase.getProperty(property); if (value != null) { unusedProperties.remove(property); } return value; }
PerformanceLogWriter(File file) { this.file = checkNotNull(file, "file can't be null"); writeHeader(); }
public static <E> E getFieldValue(Object instance, String fieldName) { checkNotNull(instance, "Object to retrieve field from can't be null"); Field field; Class<?> clazz = instance.getClass(); try { field = clazz.getDeclaredField(fieldName); field.setAccessible(true); } catch (Exception e) { throw new ReflectionException(e); } return getFieldValue0(instance, field, clazz.getName(), fieldName); }
public static <E> E getFieldValue(Object instance, String fieldName) { checkNotNull(instance, "Object to retrieve field from can't be null"); Field field; Class<?> clazz = instance.getClass(); try { field = clazz.getDeclaredField(fieldName); field.setAccessible(true); } catch (Exception e) { throw new ReflectionException(e); } return getFieldValue0(instance, field, clazz.getName(), fieldName); }
public void bind(Object object) { checkNotNull(object, "object can't be null"); Class classType = object.getClass(); do { for (Field field : classType.getDeclaredFields()) { inject(object, field); } classType = classType.getSuperclass(); } while (classType != null); Set<String> used = bindAll(object, testCase); unusedProperties.removeAll(used); if (object instanceof PropertyBindingAware) { ((PropertyBindingAware) object).bind(this); } }
public static void appendText(String text, File file) { checkNotNull(text, "Text can't be null"); checkNotNull(file, "File can't be null"); FileOutputStream stream = null; OutputStreamWriter streamWriter = null; BufferedWriter writer = null; try { stream = new FileOutputStream(file, true); streamWriter = new OutputStreamWriter(stream); writer = new BufferedWriter(streamWriter); writer.append(text); writer.close(); } catch (IOException e) { throw new UncheckedIOException("Could not append text", e); } finally { closeQuietly(writer); closeQuietly(streamWriter); closeQuietly(stream); } }
/** * Spawns a new thread for the given {@link Runnable}. * * @param namePrefix the name prefix for the thread * @param runnable the {@link Runnable} to execute * @return the created thread */ public Thread spawn(String namePrefix, Runnable runnable) { checkNotNull(namePrefix, "namePrefix can't be null"); checkNotNull(runnable, "runnable can't be null"); String name = newName(namePrefix); Thread thread; if (throwException) { thread = new ThrowExceptionThread(name, runnable); thread.setUncaughtExceptionHandler(exceptionHandler); } else { thread = new ReportExceptionThread(testId, name, runnable); } threads.add(thread); thread.start(); return thread; }