List of usage examples for java.lang Boolean parseBoolean
public static boolean parseBoolean(String s)
From source file:alfio.manager.EuVatChecker.java
private static VatDetail getVatDetail(Response resp, String vatNr, String countryCode, String organizerCountryCode) throws IOException { ResponseBody body = resp.body();/*from w w w . ja v a 2 s . co m*/ String jsonString = body != null ? body.string() : "{}"; Map<String, String> json = Json.fromJson(jsonString, new TypeReference<Map<String, String>>() { }); boolean isValid = Boolean.parseBoolean(json.get("isValid")); return new VatDetail(vatNr, countryCode, isValid, json.get("name"), json.get("address"), isValid && !organizerCountryCode.equals(countryCode)); }
From source file:com.kylinolap.job.hadoop.cube.StorageCleanupJob.java
@Override public int run(String[] args) throws Exception { Options options = new Options(); try {/* www .j a v a 2 s. co m*/ options.addOption(OPTION_DELETE); parseOptions(options, args); delete = Boolean.parseBoolean(getOptionValue(OPTION_DELETE)); Configuration conf = HBaseConfiguration.create(getConf()); cleanUnusedHdfsFiles(conf); cleanUnusedHBaseTables(conf); cleanUnusedIntermediateHiveTable(conf); return 0; } catch (Exception e) { e.printStackTrace(System.err); log.error(e.getLocalizedMessage(), e); return 2; } }
From source file:com.natpryce.piazza.BuildMonitorController.java
protected ModelAndView doHandle(HttpServletRequest request, HttpServletResponse response) throws Exception { if (requestHasParameter(request, BUILD_TYPE_ID)) { return showBuildType(request.getParameter(BUILD_TYPE_ID), response); } else if (requestHasParameter(request, PROJECT_ID)) { return showProject(request.getParameter(PROJECT_ID), Boolean.parseBoolean(request.getParameter(SHOW_FEATURE_BRANCH_BUILDS_ONLY)), response); } else {/*from ww w . ja v a2 s. c o m*/ response.sendError(HttpServletResponse.SC_BAD_REQUEST, "no build type id specified"); return null; } }
From source file:com.jdom.util.properties.PropertiesUtil.java
public static boolean getBoolean(Properties properties, String key, boolean defaultValue) { String stringValue = properties.getProperty(key, "" + defaultValue); return Boolean.parseBoolean(stringValue); }
From source file:com.oakesville.mythling.prefs.PlaybackPrefs.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getActivity().getActionBar().setTitle(R.string.title_playback_settings); addPreferencesFromResource(R.xml.playback_prefs); // none of these prefs trigger cache refresh AppSettings appSettings = new AppSettings(getPreferenceScreen().getContext()); SwitchPreference swPref = (SwitchPreference) getPreferenceScreen() .findPreference(AppSettings.FRONTEND_PLAYBACK); swPref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { doCategoryEnablement(!Boolean.valueOf(newValue.toString())); return true; }// ww w.j a va 2 s. c om }); doCategoryEnablement(appSettings.isDevicePlayback()); Preference pref = getPreferenceScreen().findPreference(AppSettings.ALWAYS_PROMPT_FOR_PLAYBACK_OPTIONS); pref.setOnPreferenceChangeListener(new PrefChangeListener(false, false) { public boolean onPreferenceChange(Preference preference, Object newValue) { boolean update = super.onPreferenceChange(preference, newValue); if (Boolean.parseBoolean(newValue.toString())) { AppSettings settings = new AppSettings(getPreferenceScreen().getContext()); try { settings.getPlaybackOptions().clearAlwaysDoThisSettings(); } catch (JSONException ex) { Log.e(TAG, ex.getMessage(), ex); if (settings.isErrorReportingEnabled()) new Reporter(ex).send(); settings.getPlaybackOptions().clearAll(); } } return update; } }); pref = getPreferenceScreen().findPreference(AppSettings.SKIP_BACK_INTERVAL); pref.setOnPreferenceChangeListener(new PrefChangeListener(true, false, getString(R.string.seconds))); pref.setSummary("" + appSettings.getSkipBackInterval() + " " + getString(R.string.seconds)); pref = getPreferenceScreen().findPreference(AppSettings.SKIP_FORWARD_INTERVAL); pref.setOnPreferenceChangeListener(new PrefChangeListener(true, false, getString(R.string.seconds))); pref.setSummary("" + appSettings.getSkipForwardInterval() + " " + getString(R.string.seconds)); pref = getPreferenceScreen().findPreference(AppSettings.JUMP_INTERVAL); pref.setOnPreferenceChangeListener(new PrefChangeListener(true, false, getString(R.string.seconds))); pref.setSummary("" + appSettings.getJumpInterval() + " " + getString(R.string.seconds)); pref = getPreferenceScreen().findPreference(AppSettings.AUTO_SKIP); pref.setOnPreferenceChangeListener( new PrefChangeListener(true, false, R.array.auto_skip_values, R.array.auto_skip_entries) { public boolean onPreferenceChange(Preference preference, Object newValue) { super.onPreferenceChange(preference, newValue); if (!AppSettings.AUTO_SKIP_OFF.equals(newValue.toString())) { AppSettings settings = new AppSettings(getPreferenceScreen().getContext()); int scTol = settings.getSeekCorrectionTolerance(); if (scTol == 0) { settings.setSeekCorrectionTolerance(3); getPreferenceScreen().findPreference(AppSettings.SEEK_CORRECTION_TOLERANCE) .setSummary("3"); ; } } return true; } }); pref.setSummary(Localizer.getStringArrayEntry(R.array.auto_skip_values, R.array.auto_skip_entries, appSettings.getAutoSkip())); pref = getPreferenceScreen().findPreference(AppSettings.SEEK_CORRECTION_TOLERANCE); pref.setOnPreferenceChangeListener(new PrefChangeListener(true, false, getString(R.string.seconds))); pref.setSummary("" + appSettings.getSeekCorrectionTolerance() + " " + getString(R.string.seconds)); pref = getPreferenceScreen().findPreference(AppSettings.LIBVLC_PARAMETERS); pref.setOnPreferenceChangeListener(new PrefChangeListener(true, false)); pref.setSummary(appSettings.getLibVlcParameters()); swPref = (SwitchPreference) getPreferenceScreen().findPreference(AppSettings.INTERNAL_MUSIC_PLAYER); swPref.setOnPreferenceChangeListener(new PrefChangeListener(false, false)); pref = getPreferenceScreen().findPreference(AppSettings.MYTH_FRONTEND_HOST); pref.setOnPreferenceChangeListener(new PrefChangeListener(true, false)); pref.setSummary(appSettings.getFrontendHost()); pref = getPreferenceScreen().findPreference(AppSettings.MYTH_FRONTEND_SOCKET_PORT); pref.setOnPreferenceChangeListener(new PrefChangeListener(true, false)); pref.setSummary("" + appSettings.getFrontendSocketPort()); pref = getPreferenceScreen().findPreference(AppSettings.MYTH_FRONTEND_SERVICE_PORT); pref.setOnPreferenceChangeListener(new PrefChangeListener(true, false)); pref.setSummary("" + appSettings.getFrontendServicePort()); }
From source file:com.baifendian.swordfish.common.hadoop.ConfigurationUtil.java
/** * ?? <p>//from www .j a v a2 s .co m */ private static void initConfiguration() { configuration.setBoolean("mapreduce.app-submission.cross-platform", Boolean.parseBoolean(PROPERTIES.getProperty("mapreduce.app-submission.cross-platform"))); configuration.set("fs.defaultFS", PROPERTIES.getProperty("fs.defaultFS")); configuration.set("mapreduce.framework.name", PROPERTIES.getProperty("mapreduce.framework.name")); configuration.set("yarn.resourcemanager.address", PROPERTIES.getProperty("yarn.resourcemanager.address")); configuration.set("yarn.resourcemanager.scheduler.address", PROPERTIES.getProperty("yarn.resourcemanager.scheduler.address")); configuration.set("mapreduce.jobhistory.address", PROPERTIES.getProperty("mapreduce.jobhistory.address")); configuration.set("yarn.resourcemanager.webapp.address", PROPERTIES.getProperty("yarn.resourcemanager.webapp.address")); configuration.set("yarn.application.status.address", PROPERTIES.getProperty("yarn.application.status.address")); configuration.set("storm.rest.url", STORM_PROPERTIES.getProperty("storm.rest.url")); configuration.set("storm.rest.topology", STORM_PROPERTIES.getProperty("storm.rest.topology")); }
From source file:ar.sgt.resolver.filter.ResolverFilter.java
@Override public void init(FilterConfig filterConfig) throws ServletException { log.debug("Initializing filter"); this.resolverConfig = (ResolverConfig) filterConfig.getServletContext() .getAttribute(ContextLoader.RESOLVER_CONFIG); this.appendBackSlash = filterConfig.getInitParameter("append_backslash") != null ? Boolean.parseBoolean(filterConfig.getInitParameter("append_backslash")) : true;//from w ww .j a v a 2 s . c o m this.filterConfig = filterConfig; if (filterConfig.getInitParameter("exclude-path") != null) { this.excludePath = new HashSet<String>( Arrays.asList(StringUtils.split(filterConfig.getInitParameter("exclude-path"), ","))); } else { this.excludePath = null; } }
From source file:rest.NoteREST.java
private Note getFormattedDataSingle(Response response) { String responseJson = response.readEntity(String.class); System.out.println(responseJson); ObjectMapper mapper = new ObjectMapper(); TypeReference<HashMap<String, Object>> typeReference = new TypeReference<HashMap<String, Object>>() { };/*from w w w . j a v a2s . c om*/ StringBuilder sb = new StringBuilder(); try { HashMap<String, Object> map = mapper.readValue(responseJson, typeReference); if (Boolean.parseBoolean(map.get("found").toString())) { return Note.parseNote(map); // } else { return null; } } catch (Exception e) { return null; } }
From source file:org.wso2.carbon.appfactory.s4.integration.utils.CloudUtils.java
/** * // ww w . j a v a2 s . co m * @param stage * @return */ public static boolean isAWSRoute53Enabled() { return Boolean.parseBoolean(ServiceReferenceHolder.getInstance().getAppFactoryConfiguration() .getFirstProperty("EnableAWSRoute53").trim()); }
From source file:com.ms.commons.fasttext.psoriasis.Configuration.java
private void init(Properties props) { quickMatch = Boolean.parseBoolean(props.getProperty(DECOR_QUICKMATCH_ENABLE_KEY, "false")); String skipStr = props.getProperty(DARTS_SKIP_VALUE_KEY, "3"); try {//from w w w. j a v a2s . c om skip = Integer.parseInt(skipStr); } catch (NumberFormatException e) { logger.error("Invalid skip value. " + e.getMessage()); throw new IllegalArgumentException(e); } pinyin = Boolean.parseBoolean(props.getProperty(DARTS_ENABLE_PINYIN_KEY, "true")); fork = Boolean.parseBoolean(props.getProperty(DARTS_ENALBLE_FORK_KEY, "true")); homophone = Boolean.parseBoolean(props.getProperty(DARTS_ENABLE_HOMOPHONE_KEY, "true")); deform = Boolean.parseBoolean(props.getProperty(DARTS_ENABLE_DEFORM_KEY, "true")); toLowcase = Boolean.parseBoolean(props.getProperty(DARTS_ENABLE_TOLOWERCASE, "true")); }