List of usage examples for java.lang Boolean TYPE
Class TYPE
To view the source code for java.lang Boolean TYPE.
Click Source Link
From source file:candr.yoclip.option.OptionSetter.java
/** * Indicates when an option is used a value must also be included. * * @return {@code true} is a value is required, {@code false} otherwise. *//*from w w w .j av a 2s. co m*/ @Override public boolean hasValue() { return (!(Boolean.TYPE.equals(getType()) || Boolean.class.isAssignableFrom(getType()))) || option.hasValue(); }
From source file:net.sf.jrf.domain.PersistentObjectDynaProperty.java
/** Constructs instance and property name and class. * @param name property name.// w ww. j av a 2 s . co m * @param cls value object <code>Class</code>. * @param readMethodName name of the read <code>Method</code> * @param writeMethodName name of the write <code>Method</code> */ public PersistentObjectDynaProperty(String name, Class cls, String readMethodName, String writeMethodName) { super(name, cls); this.readMethodName = readMethodName; this.writeMethodName = writeMethodName; if (cls.isPrimitive()) { if (cls.equals(Boolean.TYPE)) primitiveWrapperClass = Boolean.class; else if (cls.equals(Byte.TYPE)) primitiveWrapperClass = Byte.class; else if (cls.equals(Character.TYPE)) primitiveWrapperClass = Character.class; else if (cls.equals(Double.TYPE)) primitiveWrapperClass = Double.class; else if (cls.equals(Float.TYPE)) primitiveWrapperClass = Float.class; else if (cls.equals(Integer.TYPE)) primitiveWrapperClass = Integer.class; else if (cls.equals(Long.TYPE)) primitiveWrapperClass = Long.class; else if (cls.equals(Short.TYPE)) primitiveWrapperClass = Short.class; } else if (java.util.List.class.isAssignableFrom(cls) || cls.isArray()) { indexed = true; } else if (java.util.Map.class.isAssignableFrom(cls)) { mapped = true; } }
From source file:jp.co.acroquest.endosnipe.perfdoctor.rule.RuleInstanceUtil.java
/** * ??true??????<br>//ww w .j a v a 2 s . c o m * org.apache.commons.beanUtils.ConvertUtils??????<br> * Boolean?????????<br> * ????true??????????null??true?<br> * @param value * @return ?true????? */ protected static boolean checkEnabled(final String value) { if (StringUtils.isEmpty(value)) { return true; } Boolean b = (Boolean) ConvertUtils.convert(value, Boolean.TYPE); return b.booleanValue(); }
From source file:com.CodeSeance.JSeance.CodeGenXML.XMLElements.Node.java
private Object replaceJSAndConvert(ContextManager contextManager, String value, Class type) { value = contextManager.resolveCodeFragments(value); if (Boolean.TYPE.equals(type) || Boolean.class.equals(type)) { return "true".equals(value.toLowerCase()); } else if (String.class.equals(type)) { return value; } else {//from w ww . j ava 2 s .c o m // Unsupported class attribute type during Node construction assert false : type; return null; } }
From source file:org.eclim.plugin.adt.project.AndroidProjectManager.java
@Override @SuppressWarnings("static-access") public void create(IProject project, CommandLine commandLine) throws Exception { String[] args = commandLine.getValues(Options.ARGS_OPTION); GnuParser parser = new GnuParser(); org.apache.commons.cli.Options options = new org.apache.commons.cli.Options(); options.addOption(OptionBuilder.hasArg().isRequired().withLongOpt("target").create()); options.addOption(OptionBuilder.hasArg().isRequired().withLongOpt("package").create()); options.addOption(OptionBuilder.hasArg().isRequired().withLongOpt("application").create()); options.addOption(OptionBuilder.hasArg().withLongOpt("activity").create()); options.addOption(OptionBuilder.withLongOpt("library").create()); org.apache.commons.cli.CommandLine cli = parser.parse(options, args); Sdk sdk = Sdk.getCurrent();/*from ww w. j a v a2 s .c o m*/ String targetHash = cli.getOptionValue("target"); IAndroidTarget target = sdk.getTargetFromHashString(targetHash); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("SDK_TARGET", target); parameters.put("SRC_FOLDER", SdkConstants.FD_SOURCES); parameters.put("IS_NEW_PROJECT", true); parameters.put("SAMPLE_LOCATION", null); parameters.put("IS_LIBRARY", cli.hasOption("library")); parameters.put("ANDROID_SDK_TOOLS", AdtPlugin.getOsSdkToolsFolder()); parameters.put("PACKAGE", cli.getOptionValue("package")); parameters.put("APPLICATION_NAME", "@string/app_name"); parameters.put("MIN_SDK_VERSION", target.getVersion().getApiString()); if (cli.hasOption("activity")) { parameters.put("ACTIVITY_NAME", cli.getOptionValue("activity")); } Map<String, String> dictionary = new HashMap<String, String>(); dictionary.put("app_name", cli.getOptionValue("application")); // gross: the android NewProjectCreator expects to be the one to create the // project, so we have to, ug, delete the project first. IProjectDescription description = project.getDescription(); project.delete(false/*deleteContent*/, true/*force*/, null/*monitor*/); // Would be nice to use public static create method, but it doesn't provide // the option for package name, activity name, app name, etc. //NewProjectCreator.create( // new NullProgressMonitor(), // project, // target, // null /* ProjectPopulator */, // cli.hasOption("library") /* isLibrary */, // null /* projectLocation */); NewProjectCreator creator = new NewProjectCreator(null, null); invoke(creator, "createEclipseProject", new Class[] { IProgressMonitor.class, IProject.class, IProjectDescription.class, Map.class, Map.class, NewProjectCreator.ProjectPopulator.class, Boolean.TYPE, }, new NullProgressMonitor(), project, description, parameters, dictionary, null, true); project.getNature(AdtConstants.NATURE_DEFAULT).configure(); }
From source file:sorcer.launcher.JavaProcessBuilder.java
/** * Redirect output and error to ours IF the method * {@link ProcessBuilder#inheritIO()} is available (since jdk 1.7) */// w ww. java2s .c o m private void redirectIO(ProcessBuilder processBuilder) { if (output != null) { invokeIgnoreErrors(processBuilder, "redirectErrorStream", new Class[] { Boolean.TYPE }, true); // processBuilder.redirectErrorStream(true); invokeIgnoreErrors(processBuilder, "redirectOutput", new Class[] { File.class }, output); } else { invokeIgnoreErrors(processBuilder, "inheritIO", new Class[0]); } }
From source file:org.hansel.myAlert.PanicButtonFragment.java
@SuppressWarnings("rawtypes") private void setMobileDataEnabled(Context context, boolean enabled) throws ClassNotFoundException, IllegalArgumentException, IllegalAccessException, NoSuchMethodException, NoSuchFieldException, InvocationTargetException { final ConnectivityManager conman = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); final Class conmanClass = Class.forName(conman.getClass().getName()); final Field iConnectivityManagerField = conmanClass.getDeclaredField("mService"); iConnectivityManagerField.setAccessible(true); final Object iConnectivityManager = iConnectivityManagerField.get(conman); final Class iConnectivityManagerClass = Class.forName(iConnectivityManager.getClass().getName()); @SuppressWarnings("unchecked") final Method setMobileDataEnabledMethod = iConnectivityManagerClass .getDeclaredMethod("setMobileDataEnabled", Boolean.TYPE); setMobileDataEnabledMethod.setAccessible(true); setMobileDataEnabledMethod.invoke(iConnectivityManager, enabled); }
From source file:org.jcommon.com.util.config.ConfigLoader.java
public static void loadConf4xml(InputStream is, BaseConfigMBean config) throws FileNotFoundException { if (is == null) throw new FileNotFoundException(); try {//www. ja v a2 s .c om Document doc = new SAXReader().read(is); Element root = doc.getRootElement(); String element = null; Class<?> type = null; java.lang.reflect.Field[] fs = config.getClass().getDeclaredFields(); for (java.lang.reflect.Field f : fs) { element = f.getName(); String value = getTextFromElement(root, element); if (value == null) continue; type = f.getType(); Object args = null; java.lang.reflect.Method m = getMethod(config.getClass(), "set" + element); if (m == null) m = getMethod(config.getClass(), "is" + element); if (m != null) { if (notNull(value)) { if (String.class == type) { args = value; } else if (java.lang.Integer.class == type || Integer.TYPE == type) { args = Integer.valueOf(value); } else if (java.lang.Boolean.class == type || Boolean.TYPE == type) { args = Boolean.parseBoolean(value); } else if (java.lang.Long.class == type || Long.TYPE == type) { args = Long.valueOf(value); } else if (java.lang.Float.class == type || Float.TYPE == type) { args = Float.valueOf(value); } else if (java.util.Collection.class.isAssignableFrom(type)) { args = loadCollection(root, element, f); } else if (java.util.Map.class.isAssignableFrom(type)) { args = loadMap(root, element, f); } else { logger.info("not map Class:" + type); continue; } } try { m.invoke(config, args); logger.info(element + ":" + value); } catch (Exception e) { logger.warn(e); continue; } } else if (notNull(value)) logger.warn("can't find element:" + value); } try { is.close(); } catch (Exception e) { } logger.info(String.format("Read config file: %s", is)); } catch (Throwable t) { logger.error("read config file error:" + is + "\n" + t.getMessage()); } }
From source file:com.github.michalbednarski.intentslab.Utils.java
public static Object getDefaultValueForPrimitveClass(Class<?> aClass) { if (aClass == Boolean.TYPE) { return false; } else if (aClass == Byte.TYPE) { return (byte) 0; } else if (aClass == Character.TYPE) { return 0; } else if (aClass == Short.TYPE) { return (short) 0; } else if (aClass == Integer.TYPE) { return 0; } else if (aClass == Long.TYPE) { return (long) 0; } else if (aClass == Float.TYPE) { return 0; } else if (aClass == Double.TYPE) { return 0; } else {//w w w . j a v a2s .c om throw new RuntimeException("Not primitive type"); } }
From source file:org.kuali.kfs.module.ar.report.PdfFormattingMap.java
protected String stringifyValue(Object value) { if (ObjectUtils.isNull(value)) { return KFSConstants.EMPTY_STRING; } else if (value instanceof String) { return (String) value; } else if (value instanceof java.util.Date) { return getDateTimeService().toDateString((java.util.Date) value); } else if (value instanceof Boolean || Boolean.TYPE.equals(value.getClass())) { return stringifyBooleanForContractsGrantsInvoiceTemplate((Boolean) value); } else if (value instanceof KualiDecimal) { getContractsGrantsBillingUtilityService().formatForCurrency((KualiDecimal) value); }//from w ww. j ava2 s . c o m return org.apache.commons.lang.ObjectUtils.toString(value); }