method2testcases
stringlengths
118
6.63k
### Question: AnnotatedSqlStatement { public Map<String, Converter> getOutConverters() { return outConverters; } AnnotatedSqlStatement(LSql lSql, String statementSourceName, String statementName, String typeAnnotation, String sqlString); com.w11k.lsql.LSql getlSql(); String getStatementSourceName(); String getStatement...
### Question: LSql { public void executeRawSql(String sql) { Statement st = this.createStatement(); try { st.execute(sql); } catch (SQLException e) { throw new RuntimeException(e); } } LSql(Class<? extends Config> configClass, Callable<Connection> connectionProvider); LSql(Class<? extends Config> configClass, DataSour...
### Question: LinkedRow extends Row { public Optional<?> save() { return table.save(this); } Table getTable(); Object getId(); void setId(Object id); Object getRevision(); void setRevision(Object revision); void removeIdAndRevision(); @Override Object put(String key, Object value); LinkedRow putAllKnown(Row from); Opt...
### Question: LinkedRow extends Row { public void delete() { Object id = get(table.getPrimaryKeyColumn().get()); if (id == null) { throw new IllegalStateException("Can not delete this LinkedRow because the primary key value is not present."); } table.delete(this); } Table getTable(); Object getId(); void setId(Object ...
### Question: LinkedRow extends Row { public Optional<?> insert() { return table.insert(this); } Table getTable(); Object getId(); void setId(Object id); Object getRevision(); void setRevision(Object revision); void removeIdAndRevision(); @Override Object put(String key, Object value); LinkedRow putAllKnown(Row from);...
### Question: LinkedRow extends Row { public void removeIdAndRevision() { remove(table.getPrimaryKeyColumn().get()); if (table.getRevisionColumn().isPresent()) { remove(table.getRevisionColumn().get().getColumnName()); } } Table getTable(); Object getId(); void setId(Object id); Object getRevision(); void setRevision(...
### Question: Row extends ForwardingMap<String, Object> { public Row addKeyVals(Object... keyVals) { checkArgument( keyVals.length == 0 || keyVals.length % 2 == 0, "content must be a list of iterant key value pairs."); Iterable<List<Object>> partition = Iterables.partition(newArrayList(keyVals), 2); for (List<Object> o...
### Question: CodeGenUtils { public static String getJavaCodeName(String str, boolean insertUnderscoreOnCaseChange, boolean startUppercase) { if (str.length() == 0) { return str; } StringBuilder result = new StringBuilder(); String firstChar = str.substring(0, 1); result.append(startUppercase ? firstChar.toUpperCase() ...
### Question: Table { public Optional<?> save(Row row) { return this.save(row, RowSerializer.INSTANCE_SPECIAL_ROWKEY, RowDeserializer.INSTANCE_SPECIAL_ROWKEY); } Table(LSql lSql, String sqlSchemaAndTableName); Table(LSql lSql, String sqlSchemaName, String sqlTableName, String primaryKeyC...
### Question: Table { public void delete(Object id) { this.delete(id, RowDeserializer.INSTANCE_SPECIAL_ROWKEY); } Table(LSql lSql, String sqlSchemaAndTableName); Table(LSql lSql, String sqlSchemaName, String sqlTableName, String primaryKeyColumn); LSql getlSql(); String getSqlSchemaAndTa...
### Question: AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } AnnotatedSqlStatement(LSql lSql, String statementSourceName, String statementName, String typeAnnotation, String sqlString); com.w11k.lsql.LSql getlSql(); String getStateme...
### Question: GodEye { public synchronized <T> T getModule(@ModuleName String moduleName) throws UninstallException { Object moduleObj = mModules.get(moduleName); if (moduleObj == null) { throw new UninstallException("module [" + moduleName + "] is not installed."); } try { return (T) moduleObj; } catch (Throwable e) {...
### Question: GodEyeHelper { public static void onAppStartEnd(StartupInfo startupInfo) throws UninstallException { GodEye.instance().<Startup>getModule(GodEye.ModuleName.STARTUP).produce(startupInfo); L.d("GodEyeHelper onAppStartEnd: " + startupInfo); } static void onPageLoaded(Object page); static void onFragmentPage...
### Question: GodEyeHelper { public static void onNetworkEnd(NetworkInfo networkInfo) throws UninstallException { GodEye.instance().<Network>getModule(GodEye.ModuleName.NETWORK).produce(networkInfo); L.d("GodEyeHelper onNetworkEnd: %s", networkInfo == null ? "null" : networkInfo.toSummaryString()); } static void onPag...
### Question: GodEyeHelper { public static void startMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); methodCanary.startMonitor(tag); } static void onPageLoaded(Object page); static void onFragmentPageVisibilit...
### Question: GodEyeHelper { public static void stopMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); methodCanary.stopMonitor(tag); } static void onPageLoaded(Object page); static void onFragmentPageVisibilityC...
### Question: GodEye { public <S extends SubjectSupport<M>, M> Observable<M> moduleObservable(@ModuleName String moduleName) throws UninstallException { return this.<S>getModule(moduleName).subject(); } private GodEye(); static GodEye instance(); synchronized GodEye install(final GodEyeConfig godEyeConfig, Notificatio...
### Question: GodEyeHelper { public static boolean isMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); return methodCanary.isRunning(tag); } static void onPageLoaded(Object page); static void onFragmentPageVisib...
### Question: MemoryUtil { public static HeapInfo getAppHeapInfo() { Runtime runtime = Runtime.getRuntime(); HeapInfo heapInfo = new HeapInfo(); heapInfo.freeMemKb = runtime.freeMemory() / 1024; heapInfo.maxMemKb = Runtime.getRuntime().maxMemory() / 1024; heapInfo.allocatedKb = (Runtime.getRuntime().totalMemory() - run...
### Question: MemoryUtil { public static PssInfo getAppPssInfo(Context context) { final int pid = ProcessUtils.getCurrentPid(); if (sActivityManager == null) { sActivityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); } Debug.MemoryInfo memoryInfo = sActivityManager.getProcessMemoryInfo(n...
### Question: MemoryUtil { public static RamInfo getRamInfo(Context context) { if (sActivityManager == null) { sActivityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); } final ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); sActivityManager.getMemoryInfo(mi); final RamI...
### Question: MethodCanaryConverter { static MethodsRecordInfo convertToMethodsRecordInfo(long startMillis, long stopMillis, Map<ThreadInfo, List<MethodEvent>> methodEventMap) { MethodsRecordInfo methodsRecordInfo = new MethodsRecordInfo(startMillis, stopMillis, new ArrayList<>()); if (methodEventMap == null || methodE...
### Question: ViewCanaryInternal { @VisibleForTesting Runnable inspectInner(WeakReference<Activity> activity, ViewCanary viewCanary, ViewCanaryConfig config, Map<Activity, List<List<ViewIdWithSize>>> recentLayoutListRecords) { return () -> { try { Activity p = activity.get(); if (p != null) { ViewGroup parent = (ViewGr...
### Question: Network extends ProduceableSubject<NetworkInfo> implements Install<NetworkConfig> { @Override public void produce(NetworkInfo data) { if (mConfig == null) { L.d("Network is not installed, produce data fail."); return; } super.produce(data); } @Override synchronized boolean install(NetworkConfig config); ...
### Question: Startup extends ProduceableSubject<StartupInfo> implements Install<StartupConfig> { @Override public void produce(StartupInfo data) { if (mConfig == null) { L.d("Startup is not installed, produce data fail."); return; } super.produce(data); } @Override synchronized boolean install(StartupConfig config); ...
### Question: PageLifecycleMethodEventTypes { static boolean isMatch(LifecycleEvent lifecycleEvent0, LifecycleEvent lifecycleEvent1) { return lifecycleEvent0.equals(lifecycleEvent1); } }### Answer: @Test public void isMatch() { Assert.assertTrue(PageLifecycleMethodEventTypes.isMatch(ActivityLifecycleEvent.ON_CREATE,...
### Question: PageLifecycleMethodEventTypes { static LifecycleEvent convert(PageType pageType, MethodEvent lifecycleMethodEvent) { return sPairsOfLifecycleAndMethods.get(new MethodInfoForLifecycle(pageType, lifecycleMethodEvent)); } }### Answer: @Test public void convert() { Assert.assertNull(PageLifecycleMethodEven...
### Question: GodEye { public <S extends SubjectSupport<M>, M> Disposable observeModule(@ModuleName String moduleName, Consumer<M> consumer) throws UninstallException { return this.<S>getModule(moduleName).subject().subscribeOn(Schedulers.computation()).observeOn(Schedulers.computation()).subscribe(consumer); } private...
### Question: LeakDetector extends ProduceableSubject<LeakQueue.LeakMemoryInfo> implements Install<LeakConfig> { public static LeakDetector instance() { return LeakDetector.InstanceHolder.sINSTANCE; } private LeakDetector(); static LeakDetector instance(); @Override synchronized boolean install(LeakConfig config); @Ov...
### Question: AppSizeUtil { @SuppressWarnings("JavaReflectionMemberAccess") private static void getAppSizeLowerO(Context context, @NonNull final OnGetSizeListener listener) { try { Method method = PackageManager.class.getMethod("getPackageSizeInfo", String.class, IPackageStatsObserver.class); method.invoke(context.getP...
### Question: AppSizeUtil { static String formatSize(long size) { if (size / (1024 * 1024 * 1024) > 0) { float tmpSize = (float) (size) / (float) (1024 * 1024 * 1024); DecimalFormat df = new DecimalFormat("#.##"); return df.format(tmpSize) + "GB"; } else if (size / (1024 * 1024) > 0) { float tmpSize = (float) (size) / ...
### Question: Sm extends ProduceableSubject<BlockInfo> implements Install<SmConfig> { public void setSmConfigCache(SmConfig smConfigCache) { if (smConfigCache == null || !smConfigCache.isValid()) { return; } SharedPreferences sharedPreferences = GodEye.instance().getApplication().getSharedPreferences("AndroidGodEye", 0...
### Question: CpuUsage { @VisibleForTesting static CpuSnapshot parse(String cpuRate, String pidCpuRate) { String[] cpuInfoArray = cpuRate.split("\\s+"); if (cpuInfoArray.length < 9) { throw new IllegalStateException("cpu info array size must great than 9"); } long user = Long.parseLong(cpuInfoArray[2]); long nice = Lon...
### Question: CpuUsage { @VisibleForTesting static float parseCpuRateOfAppByShell(String line, int cpuIndex, Float cpuTotal) { if (line.startsWith(String.valueOf(android.os.Process.myPid()))) { if (cpuIndex == -1) { throw new IllegalStateException("parseCpuRateOfAppByShell but cpuIndex == -1:" + line); } String[] param...
### Question: CpuUsage { @VisibleForTesting static Map<String, Float> parseCpuRateOfDeviceAndTotalByShell(String line) { if (line.matches("^\\d+%\\w+.+\\d+%\\w+")) { String lineLowerCase = line.toLowerCase(Locale.US); String[] cpuList = lineLowerCase.split("\\s+"); Map<String, Float> cpuMap = new HashMap<>(); for (Stri...
### Question: CpuUsage { @VisibleForTesting static int parseCPUIndex(String line) { if (line.contains("CPU")) { String[] titles = line.split("\\s+"); for (int i = 0; i < titles.length; i++) { if (titles[i].contains("CPU")) { return i; } } } return -1; } static CpuInfo getCpuInfo(); }### Answer: @Test public void pars...
### Question: ImageCanaryInternal { @VisibleForTesting Runnable inspectInner(WeakReference<Activity> activity, ImageCanary imageCanaryEngine, Set<ImageIssue> imageIssues) { return () -> { try { Activity p = activity.get(); if (p != null) { ViewGroup parent = (ViewGroup) p.getWindow().getDecorView(); recursiveLoopChildr...
### Question: NotificationConsumer implements Consumer<NotificationContent> { @Override public void accept(NotificationContent notificationContent) throws Exception { ThreadUtil.ensureWorkThread("NotificationConsumer"); if (mNotification == null) { return; } mNotification.onNotificationReceive(System.currentTimeMillis(...
### Question: GodEye { public Application getApplication() { return mApplication; } private GodEye(); static GodEye instance(); synchronized GodEye install(final GodEyeConfig godEyeConfig, NotificationConfig notificationConfig); GodEye install(final GodEyeConfig godEyeConfig); GodEye install(final GodEyeConfig godEyeC...
### Question: LocalNotificationListenerService extends Service { public static void start(String message, boolean isStartup) { Intent intent = new Intent(GodEye.instance().getApplication(), LocalNotificationListenerService.class); intent.putExtra("message", message); intent.putExtra("isStartup", isStartup); intent.setA...
### Question: LocalNotificationListenerService extends Service { public static void stop() { Intent intent = new Intent(GodEye.instance().getApplication(), LocalNotificationListenerService.class); intent.setAction(ACTION_STOP); GodEye.instance().getApplication().startService(intent); } static void start(String message...
### Question: L { public static void d(Object msg) { if (sLogProxy != null) { sLogProxy.d(o2String(msg)); } } static void setProxy(LogProxy logProxy); static void d(Object msg); static void d(String format, Object... msgs); static void e(Object msg); static void w(Object msg); static void onRuntimeException(RuntimeExc...
### Question: L { public static void e(Object msg) { if (sLogProxy != null) { sLogProxy.e(o2String(msg)); } } static void setProxy(LogProxy logProxy); static void d(Object msg); static void d(String format, Object... msgs); static void e(Object msg); static void w(Object msg); static void onRuntimeException(RuntimeExc...
### Question: L { public static void w(Object msg) { if (sLogProxy != null) { sLogProxy.w(o2String(msg)); } } static void setProxy(LogProxy logProxy); static void d(Object msg); static void d(String format, Object... msgs); static void e(Object msg); static void w(Object msg); static void onRuntimeException(RuntimeExc...
### Question: L { public static void onRuntimeException(RuntimeException e) { if (sLogProxy != null) { sLogProxy.onRuntimeException(e); } } static void setProxy(LogProxy logProxy); static void d(Object msg); static void d(String format, Object... msgs); static void e(Object msg); static void w(Object msg); static void...
### Question: ImageUtil { public static String convertToBase64(Bitmap bitmap, int maxWidth, int maxHeight) { if (bitmap == null) { return null; } long startTime = System.currentTimeMillis(); int[] targetSize = computeTargetSize(bitmap, maxWidth, maxHeight); Bitmap thumbnail = ThumbnailUtils.extractThumbnail(bitmap, tar...
### Question: ImageUtil { @VisibleForTesting static int[] computeTargetSize(Bitmap bitmap, int maxWidth, int maxHeight) { int width = bitmap.getWidth(); int height = bitmap.getHeight(); float targetWidth = width; float targetHeight = height; if (width > maxWidth || height > maxHeight) { float scaleWidth = (width * 1.0f...
### Question: ThreadUtil { public static boolean isMainThread() { return Looper.myLooper() == Looper.getMainLooper(); } static void setNeedDetectRunningThread(boolean sNeedDetect); static void setMainScheduler(Scheduler sMainScheduler); static void setComputationScheduler(Scheduler sComputationScheduler); static Sched...
### Question: ProcessUtils { public static String myProcessName(Context context) { if (sProcessName != null) { return sProcessName; } synchronized (sNameLock) { if (sProcessName != null) { return sProcessName; } sProcessName = obtainProcessName(context); return sProcessName; } } static String myProcessName(Context con...
### Question: ProcessUtils { public static int getCurrentPid() { return android.os.Process.myPid(); } static String myProcessName(Context context); static int getCurrentPid(); static int getCurrentUid(); static boolean isMainProcess(Application application); }### Answer: @Test public void getCurrentPid() { int pid = ...
### Question: ProcessUtils { public static int getCurrentUid() { return android.os.Process.myUid(); } static String myProcessName(Context context); static int getCurrentPid(); static int getCurrentUid(); static boolean isMainProcess(Application application); }### Answer: @Test public void getCurrentUid() { int uid = ...
### Question: ProcessUtils { public static boolean isMainProcess(Application application) { int pid = android.os.Process.myPid(); String processName = ""; ActivityManager manager = (ActivityManager) application.getSystemService (Context.ACTIVITY_SERVICE); for (ActivityManager.RunningAppProcessInfo process : manager.get...
### Question: StacktraceUtil { public static List<String> stackTraceToStringArray(List<StackTraceElement> stackTraceElements) { List<String> stackList = new ArrayList<>(); for (StackTraceElement traceElement : stackTraceElements) { stackList.add(String.valueOf(traceElement)); } return stackList; } static List<String> ...
### Question: StacktraceUtil { public static List<String> getStackTraceOfThread(Thread thread) { StackTraceElement[] stackTraceElements = thread.getStackTrace(); return stackTraceToStringArray(Arrays.asList(stackTraceElements)); } static List<String> stackTraceToStringArray(List<StackTraceElement> stackTraceElements);...
### Question: StacktraceUtil { public static String getStringOfThrowable(Throwable throwable) { return throwable.getLocalizedMessage() + "\n" + stackTraceToString(throwable.getStackTrace()); } static List<String> stackTraceToStringArray(List<StackTraceElement> stackTraceElements); static List<String> getStackTraceOfTh...
### Question: ReflectUtil { public static <T> T invokeStaticMethod(String clsName, String methodName, Class<?>[] argsTypes, Object[] args) { return invokeStaticMethod(getClass(clsName), methodName, argsTypes, args); } static T invokeStaticMethod(String clsName, String methodName, Class<?>[] argsTypes, Object[] args); ...
### Question: GodEyeConfig implements Serializable { public static GodEyeConfig noneConfig() { return noneConfigBuilder().build(); } private GodEyeConfig(); static GodEyeConfigBuilder noneConfigBuilder(); static GodEyeConfig noneConfig(); static GodEyeConfigBuilder defaultConfigBuilder(); static GodEyeConfig defaultCo...
### Question: GodEyeConfig implements Serializable { public static GodEyeConfig fromAssets(String assetsPath) { InputStream is = null; try { is = GodEye.instance().getApplication().getAssets().open(assetsPath); return fromInputStream(is); } catch (Exception e) { L.e(e); return GodEyeConfig.noneConfig(); } finally { IoU...
### Question: AndroidDebug { public static boolean isDebugging() { return Debug.isDebuggerConnected(); } static boolean isDebugging(); }### Answer: @Test public void isDebugging() { long startTime = SystemClock.elapsedRealtime(); for (int i = 0; i < 1000; i++) { AndroidDebug.isDebugging(); } Log4Test.d(String.format(...
### Question: Notifier { public static int notice(Context context, Config config) { return notice(context, createNoticeId(), create(context, config)); } static Notification create(Context context, Config config); static int createNoticeId(); static int notice(Context context, Config config); static int notice(Context ...
### Question: GodEyeHelper { public static void onFragmentPageVisibilityChange(Object fragmentPage, boolean visible) throws UninstallException { if (fragmentPage instanceof Fragment) { if (visible) { GodEye.instance().<Pageload>getModule(GodEye.ModuleName.PAGELOAD).onFragmentV4Show((Fragment) fragmentPage); } else { Go...
### Question: WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Override public void customize(ConfigurableEmbeddedServletContainer container) { MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT); mappings.add("html", "text/html;charset=utf-8"); mappings.add("json", "...
### Question: DefaultAudioSink implements AudioSink { @Override public boolean supportsOutput(int channelCount, @C.Encoding int encoding) { if (Util.isEncodingLinearPcm(encoding)) { return encoding != C.ENCODING_PCM_FLOAT || Util.SDK_INT >= 21; } else { return audioCapabilities != null && audioCapabilities.supportsEnco...
### Question: Hook { boolean isValid() { try { new URL(this.uri); } catch (MalformedURLException ex) { return false; } return this.command != null; } Hook(String uri, FtpEventName command); Hook(); long getId(); String getUri(); FtpEventName getCommand(); void setCommand(FtpEventName command); static final String find...
### Question: RegexReplacement { public String replace(String in) { boolean matches = regex.matcher(in).find(); if(matches) { return in.replaceAll(original, replacement); } else { return in; } } RegexReplacement(String regex, String original, String replacement); boolean match(String in); String replace(String in); }#...
### Question: CommandExecutor implements Executor { @Override public int execute(final List<String> commandInformation, File workingDir) throws IOException, InterruptedException { int exitValue = -99; try { ProcessBuilder pb = new ProcessBuilder(commandInformation); pb.directory(workingDir); Process process = pb.start(...
### Question: ExtendedProperties implements Map<String, String>, Serializable, Cloneable { @Override public void putAll(final Map<? extends String, ? extends String> map) { for (Entry<? extends String, ? extends String> entry : map.entrySet()) { put(entry.getKey(), entry.getValue()); } } ExtendedProperties(); Extended...
### Question: CheckHtml4String extends WebDriverStep { @Override public void execute() { log.info("String '{}' must {}exist in the page source. Search is {}case-sensitive.", string, mustExist ? "" : "not ", caseSensitive ? "" : "not "); String pageSource = getWebDriver().getPageSource(); boolean outcome = caseSensitive...
### Question: ExcelDataSource extends BaseDataSource { @Override public boolean hasMoreData(final String dataSetKey) { for (ExcelFile excelFile : getExcelFiles()) { Map<String, List<Map<String, String>>> data = excelFile.getData(); List<Map<String, String>> dataList = data.get(dataSetKey); if (dataList != null) { Mutab...
### Question: CsvDataSource extends BaseDataSource { @Override public boolean hasMoreData(final String dataSetKey) { if (getCsvFiles().containsKey(dataSetKey)) { CsvFile csvFile = getCsvFiles().get(dataSetKey); if (csvFile.lines == null) { try { csvFile.load(); } catch (IOException e) { throw new IllegalArgumentExcepti...
### Question: ContainerDataSource implements DataSource { @Override public DataSet getNextDataSet(final String key) { List<? extends DataSource> dataSources = dataSourcesProvider.get(); for (DataSource ds : dataSources) { DataSet data = ds.getNextDataSet(key); if (data != null) { return data; } } return null; } @Inject...
### Question: ExtendedProperties implements Map<String, String>, Serializable, Cloneable { public Properties toProperties() { Properties props = new Properties(); for (String key : keySet()) { props.put(key, get(key)); } return props; } ExtendedProperties(); ExtendedProperties(final Map<String, String> defaults); stat...
### Question: ArchiveDataSource extends BaseDataSource { @Override public boolean hasMoreData(final String dataSetKey) { return true; } @Inject ArchiveDataSource(final Configuration configuration); @Override boolean hasMoreData(final String dataSetKey); @Override void doReset(); }### Answer: @Test(dataProvider = "dat...
### Question: LoremIpsumGenerator { public String generateLoremIpsum(final int length) { if (loremLength < length) { int multiplier = length / loremLength; int remainder = length % loremLength; StrBuilder sb = new StrBuilder(multiplier * length + remainder); for (int i = 0; i < multiplier; ++i) { sb.append(loremIpsum);...
### Question: LoremIpsumField extends Field { @Override public String getString(final FieldCase c) { int size = c.getSize(); if (size == FieldCase.JUST_ABOVE_MAX) { size++; } else if (size == FieldCase.JUST_BELOW_MIN) { size--; } if (size <= 0) { return ""; } int loremLength = loremIpsum.length(); if (loremLength < siz...
### Question: DataSetAdapter extends ForwardingMap<String, String> { @Override public String get(final Object key) { String[] pair = getKeysPair(key); if (pair.length == 1) { return null; } String dsKey = pair[0]; DataSet currentDataSet = dataSourceProvider.get().getCurrentDataSet(dsKey); if (currentDataSet == null) { ...
### Question: ScreenCapturer { public static void captureScreen(final File file) { Rectangle rectangle = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); captureScreenRect(file, rectangle); } @Inject ScreenCapturer(@ModuleArchiveDir final Provider<File> moduleArchiveDirProvider, final Set<Class<? extends...
### Question: ExtendedProperties implements Map<String, String>, Serializable, Cloneable { @Override public ExtendedProperties clone() { try { ExtendedProperties clone = (ExtendedProperties) super.clone(); clone.keySet = null; clone.entrySet = null; clone.values = null; clone.propsMap = new ConcurrentHashMap<String, St...
### Question: ScreenCapturer { @Subscribe @AllowConcurrentEvents public void handleEvent(final AbstractBaseEvent event) { Class<? extends AbstractBaseEvent> clazz = event.getClass(); boolean errorCapture = captureScreenOnError(event); boolean eventConfigured = screenCaptureEvents.contains(clazz); if (eventConfigured ||...
### Question: CsvDataProcessor { @Inject CsvDataProcessor(final Provider<Configuration> configProvider, final Provider<DataSource> dataSourceProvider) { this.configProvider = configProvider; this.dataSourceProvider = dataSourceProvider; } @Inject CsvDataProcessor(final Provider<Configuration> configProvider, final Pro...
### Question: EmailModule extends BaseJFunkGuiceModule { @Provides @Singleton SetMultimap<String, MailAccount> provideEmailAddressPools(final Configuration config) { SetMultimap<String, MailAccount> result = HashMultimap.create(); Set<String> accountIdCache = newHashSet(); for (Entry<String, String> entry : config.entr...
### Question: MailAccountManager { public MailAccount reserveMailAccount() { return reserveMailAccount(DEFAULT_ACCOUNT_RESERVATION_KEY); } @Inject MailAccountManager(final SetMultimap<String, MailAccount> emailAddressPools, final MathRandom random, final Provider<EventBus> eventBusProvider, final Configuration conf...
### Question: ExtendedProperties implements Map<String, String>, Serializable, Cloneable { public static ExtendedProperties fromProperties(final Properties props) { ExtendedProperties result = new ExtendedProperties(); for (Enumeration<?> en = props.propertyNames(); en.hasMoreElements();) { String key = (String) en.nex...
### Question: ExtendedProperties implements Map<String, String>, Serializable, Cloneable { @Override public Set<String> keySet() { if (keySet == null) { keySet = new KeySet(); } return keySet; } ExtendedProperties(); ExtendedProperties(final Map<String, String> defaults); static ExtendedProperties fromProperties(final...
### Question: ExtendedProperties implements Map<String, String>, Serializable, Cloneable { @Override public Collection<String> values() { if (values == null) { values = new Values(); } return values; } ExtendedProperties(); ExtendedProperties(final Map<String, String> defaults); static ExtendedProperties fromPropertie...
### Question: ExtendedProperties implements Map<String, String>, Serializable, Cloneable { @Override public Set<Entry<String, String>> entrySet() { if (entrySet == null) { entrySet = new EntrySet(); } return entrySet; } ExtendedProperties(); ExtendedProperties(final Map<String, String> defaults); static ExtendedProper...
### Question: ExtendedProperties implements Map<String, String>, Serializable, Cloneable { @Override public boolean containsKey(final Object key) { return propsMap.containsKey(key) ? true : defaults != null && defaults.containsKey(key); } ExtendedProperties(); ExtendedProperties(final Map<String, String> defaults); st...
### Question: ExtendedProperties implements Map<String, String>, Serializable, Cloneable { @Override public boolean containsValue(final Object value) { for (String key : keySet()) { if (value.equals(get(key))) { return true; } } return false; } ExtendedProperties(); ExtendedProperties(final Map<String, String> default...
### Question: ThreadScope extends BaseScope { @Override public <T> Provider<T> scope(final Key<T> key, final Provider<T> unscoped) { return new Provider<T>() { @Override public T get() { Map<Key<?>, Object> map = getScopeMapForCurrentThread(); checkState(map != null, "No scope map found for the current thread. Forgot t...
### Question: WmsVersion implements Comparable<WmsVersion> { @Override public int compareTo(WmsVersion o) { if (o == null) { throw new NullPointerException("Version to compare to must not be null"); } if (this.major != o.major) { return this.major < o.major ? -1 : 1; } if (this.minor != o.minor) { return this.minor < o...
### Question: WmsRequestBuilder { public WmsRequestBuilder transparent(boolean transparent) { parameters.put(WmsRequestParameter.TRANSPARENT, Boolean .valueOf(transparent) .toString()); return this; } static WmsRequestBuilder createGetMapRequest(String serviceUrl); static WmsRequestBuilder createGetMapRequest( M...
### Question: WmsRequestBuilder { public WmsRequestBuilder version(String version) { parameters.put(WmsRequestParameter.VERSION, version); return this; } static WmsRequestBuilder createGetMapRequest(String serviceUrl); static WmsRequestBuilder createGetMapRequest( Map<WmsRequestParameter, String> params); WmsReq...
### Question: WmsVersion implements Comparable<WmsVersion> { @Override public String toString() { return format("%d.%d.%d", major, minor, build); } WmsVersion(String version); WmsVersion(int major, int minor, int build); int getMajor(); int getMinor(); int getBuild(); @Override int compareTo(WmsVersion o); @Override S...
### Question: WmsVersion implements Comparable<WmsVersion> { public String toVersionString() { StringBuilder version = new StringBuilder(); version.append(major); if (minor != 0) { version.append('.').append(minor); } if (build != 0) { version.append('.').append(build); } return version.toString(); } WmsVersion(String ...
### Question: WmsMapElementHtmlHandler implements GenericElementHtmlHandler { @Override public boolean toExport(JRGenericPrintElement element) { return true; } static WmsMapElementHtmlHandler getInstance(); @Override String getHtmlFragment(JRHtmlExporterContext context, JRGenericPrintElement element); @Override ...
### Question: WmsMapElementHtmlHandler implements GenericElementHtmlHandler { @Override public String getHtmlFragment(JRHtmlExporterContext context, JRGenericPrintElement element) { Map<String, Object> contextMap = new HashMap<String, Object>(); contextMap.put("mapCanvasId", "map_canvas_" + element.hashCode()); if (con...
### Question: WmsMapElementGraphics2DHandler implements GenericElementGraphics2DHandler { @Override public void exportElement(JRGraphics2DExporterContext context, JRGenericPrintElement element, Graphics2D grx, Offset offset) { try { JRGraphics2DExporter exporter = (JRGraphics2DExporter) context .getExporter(); Imag...
### Question: WmsMapElementGraphics2DHandler implements GenericElementGraphics2DHandler { @Override public boolean toExport(JRGenericPrintElement element) { return true; } static WmsMapElementGraphics2DHandler getInstance(); @Override void exportElement(JRGraphics2DExporterContext context, JRGenericPrintElem...
### Question: WmsRequestBuilder { public URL toMapUrl() throws MalformedURLException { StringBuilder url = new StringBuilder(); Map<WmsRequestParameter, String> params = new LinkedHashMap<WmsRequestParameter, String>(this.parameters); String wmsUrl = params.remove(WmsRequestParameter.WMS_URL).toString(); url.append(wms...
### Question: Station { @JsonSetter("tags") public void setTags(final String commaTags) { tagList = Arrays.asList(commaTags.split(",")); } @JsonGetter("tags") String getTags(); @JsonSetter("tags") void setTags(final String commaTags); @JsonGetter("language") String getLanguage(); @JsonSetter("language") void setLangua...