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:ca.sqlpower.architect.swingui.TestPlayPenComponent.java
/** * Returns true if an instance of the given property type is of a mutable class. * Throws an exception if it lacks a case for the given type. * /*from www. j av a 2 s. c o m*/ * @param property The property that should be checked for mutability. */ private boolean isPropertyInstanceMutable(PropertyDescriptor property) { if (property.getPropertyType() == String.class) { return false; } else if (property.getPropertyType().isAssignableFrom(Enum.class)) { return false; } else if (property.getPropertyType() == Boolean.class || property.getPropertyType() == Boolean.TYPE) { return false; } else if (property.getPropertyType() == Integer.class || property.getPropertyType() == Integer.TYPE) { return false; } else if (property.getPropertyType() == Double.class || property.getPropertyType() == Double.TYPE) { return false; } else if (property.getPropertyType() == Color.class) { return false; } else if (property.getPropertyType() == Font.class) { return false; } else if (property.getPropertyType() == Point.class) { return true; } else if (property.getPropertyType() == Dimension.class) { return true; } else if (property.getPropertyType() == Insets.class) { return true; } else if (property.getPropertyType() == Set.class) { return true; } else if (property.getPropertyType() == List.class) { return true; } else if (property.getPropertyType() == TablePane.class) { return true; } else if (property.getPropertyType() == SQLTable.class) { return true; } else if (property.getPropertyType() == JPopupMenu.class) { return true; } if (property.getName().equals("model")) { return true; } throw new RuntimeException("This test case lacks a value for " + property.getName() + " (type " + property.getPropertyType().getName() + ") in isPropertyInstanceMutable()"); }
From source file:org.rhq.helpers.bundleGen.XmlQuestionsReader.java
private void fillObject(Object target, String prop, String type, String res) throws Exception { String setterName = "set" + caps(prop); Method setter;/* ww w . j av a 2 s . com*/ Class clazz = target.getClass(); Method[] methods = clazz.getDeclaredMethods(); if ("bool".equals(type)) { setter = clazz.getMethod(setterName, Boolean.TYPE); setter.invoke(target, Boolean.valueOf(res)); } else { setter = clazz.getMethod(setterName, String.class); setter.invoke(target, res); } }
From source file:org.apache.struts.action.TestDynaActionForm.java
/** * Positive getDynaProperty on property <code>booleanProperty</code>. *//*from w ww . j av a 2 s . c o m*/ public void testGetDescriptorBoolean() { testGetDescriptorBase("booleanProperty", Boolean.TYPE); }
From source file:org.wrml.runtime.syntax.DefaultSyntaxLoader.java
private final void loadSystemSyntaxes() { for (final SystemSyntax systemSyntax : SystemSyntax.values()) { final SyntaxHandler<?> syntaxHandler = systemSyntax.getSyntaxHandler(); switch (systemSyntax) { case Boolean: _SyntaxHandlers.put(Boolean.TYPE, syntaxHandler); break; case Double: _SyntaxHandlers.put(Double.TYPE, syntaxHandler); break; case Integer: _SyntaxHandlers.put(Integer.TYPE, syntaxHandler); break; case Long: _SyntaxHandlers.put(Long.TYPE, syntaxHandler); break; default://from w ww. j a v a2s . c om break; } final URI syntaxUri = systemSyntax.getSyntaxUri(); loadSyntaxInternal(syntaxUri, syntaxHandler); } final Context context = getContext(); // Loop again to build the system Syntax models now that the for (final SystemSyntax systemSyntax : SystemSyntax.values()) { final Syntax syntax = context.newModel(Syntax.class); final URI syntaxUri = systemSyntax.getSyntaxUri(); syntax.setUniqueName(systemSyntax.getUniqueName()); syntax.setUri(syntaxUri); _SystemSyntaxes.put(syntaxUri, syntax); } }
From source file:nl.strohalm.cyclos.controls.payments.conversionsimulation.SimulateConversionAction.java
private DataBinder<ConversionSimulationDTO> getDataBinder() { try {/*from w w w . j av a 2s .c o m*/ lock.readLock().lock(); if (dataBinder == null) { final LocalSettings localSettings = settingsService.getLocalSettings(); final BeanBinder<ConversionSimulationDTO> binder = BeanBinder .instance(ConversionSimulationDTO.class); binder.registerBinder("account", PropertyBinder.instance(MemberAccount.class, "account")); binder.registerBinder("transferType", PropertyBinder.instance(TransferType.class, "transferType")); binder.registerBinder("amount", PropertyBinder.instance(BigDecimal.class, "amount", localSettings.getNumberConverter())); binder.registerBinder("useActualRates", PropertyBinder.instance(Boolean.TYPE, "useActualRates")); binder.registerBinder("arate", PropertyBinder.instance(BigDecimal.class, "arate", localSettings.getNumberConverter())); binder.registerBinder("drate", PropertyBinder.instance(BigDecimal.class, "drate", localSettings.getNumberConverter())); binder.registerBinder("date", PropertyBinder.instance(Calendar.class, "date", localSettings.getRawDateConverter())); binder.registerBinder("graph", PropertyBinder.instance(Boolean.TYPE, "graph")); dataBinder = binder; } return dataBinder; } finally { lock.readLock().unlock(); } }
From source file:org.ow2.parengine.util.RLibPathConfigurator.java
private static void setEnvVar(String var, String value) { Class<?> clazz;//from w ww .java2 s . c o m try { clazz = Class.forName("org.ow2.proactive.utils.Environment"); } catch (Exception e) { // This can occur for scheduler > 3.4.0 try { clazz = Class.forName("org.ow2.proactive.scheduler.util.process.Environment"); } catch (Exception ee) { throw new IllegalStateException( "Unable to load Environement class required to set the env variable " + var, e); } } try { Method method = clazz.getMethod("setenv", String.class, String.class, Boolean.TYPE); method.invoke(null, var, value, true); } catch (Exception e) { throw new IllegalStateException("Unable to set the env variable " + var, e); } }
From source file:org.bytesoft.bytejta.supports.springcloud.SpringCloudCoordinator.java
private String serialize(Serializable arg) throws IOException { if (Xid.class.isInstance(arg)) { Xid xid = (Xid) arg; byte[] globalTransactionId = xid.getGlobalTransactionId(); return ByteUtils.byteArrayToString(globalTransactionId); } else if (Integer.class.isInstance(arg) || Integer.TYPE.isInstance(arg)) { return String.valueOf(arg); } else if (Boolean.class.isInstance(arg) || Boolean.TYPE.isInstance(arg)) { return String.valueOf(arg); } else {/* w w w .j a v a2 s.co m*/ byte[] byteArray = CommonUtils.serializeObject(arg); return ByteUtils.byteArrayToString(byteArray); } }
From source file:org.apache.mina.statemachine.transition.MethodTransition.java
@SuppressWarnings("unchecked") private boolean match(Class<?> paramType, Object arg, Class argType) { if (paramType.isPrimitive()) { if (paramType.equals(Boolean.TYPE)) { return arg instanceof Boolean; }/* w w w .jav a 2s . co m*/ if (paramType.equals(Integer.TYPE)) { return arg instanceof Integer; } if (paramType.equals(Long.TYPE)) { return arg instanceof Long; } if (paramType.equals(Short.TYPE)) { return arg instanceof Short; } if (paramType.equals(Byte.TYPE)) { return arg instanceof Byte; } if (paramType.equals(Double.TYPE)) { return arg instanceof Double; } if (paramType.equals(Float.TYPE)) { return arg instanceof Float; } if (paramType.equals(Character.TYPE)) { return arg instanceof Character; } } return argType.isAssignableFrom(paramType) && paramType.isAssignableFrom(arg.getClass()); }
From source file:org.kordamp.ezmorph.bean.MorphDynaBean.java
protected boolean isDynaAssignable(Class dest, Class src) { boolean assignable = dest.isAssignableFrom(src); if (assignable) { return true; }/*from w ww.ja v a2 s . c o m*/ assignable = (dest == Boolean.TYPE && src == Boolean.class) || assignable; assignable = (dest == Byte.TYPE && src == Byte.class) || assignable; assignable = (dest == Character.TYPE && src == Character.class) || assignable; assignable = (dest == Short.TYPE && src == Short.class) || assignable; assignable = (dest == Integer.TYPE && src == Integer.class) || assignable; assignable = (dest == Long.TYPE && src == Long.class) || assignable; assignable = (dest == Float.TYPE && src == Float.class) || assignable; assignable = (dest == Double.TYPE && src == Double.class) || assignable; if (src == Double.TYPE || Double.class.isAssignableFrom(src)) { assignable = (isByte(dest) || isShort(dest) || isInteger(dest) || isLong(dest) || isFloat(dest)) || assignable; } if (src == Float.TYPE || Float.class.isAssignableFrom(src)) { assignable = (isByte(dest) || isShort(dest) || isInteger(dest) || isLong(dest)) || assignable; } if (src == Long.TYPE || Long.class.isAssignableFrom(src)) { assignable = (isByte(dest) || isShort(dest) || isInteger(dest)) || assignable; } if (src == Integer.TYPE || Integer.class.isAssignableFrom(src)) assignable = (isByte(dest) || isShort(dest)) || assignable; if (src == Short.TYPE || Short.class.isAssignableFrom(src)) { assignable = (isByte(dest)) || assignable; } return assignable; }
From source file:com.collaborne.jsonschema.generator.pojo.PojoGenerator.java
@Inject @VisibleForTesting// w w w .j a v a2s. c o m protected PojoGenerator(PojoClassGenerator classGenerator, PojoArrayGenerator arrayGenerator, PojoStringGenerator stringGenerator) { this.typeGenerators.put("object", classGenerator); this.typeGenerators.put("array", arrayGenerator); if (getFeature(FEATURE_USE_SIMPLE_PLAIN_TYPES)) { // TODO: if additional restrictions are given on these types we can either implement specific // types (for example we provide a base library for each of the plain types, and configure them // to check the restrictions), or we could simply ignore those. this.typeGenerators.put("string", new SimplePojoTypeGenerator(ClassName.create(String.class))); } else { this.typeGenerators.put("string", stringGenerator); } this.typeGenerators.put("integer", new SimplePojoTypeGenerator(ClassName.create(Integer.TYPE))); this.typeGenerators.put("number", new SimplePojoTypeGenerator(ClassName.create(Double.TYPE))); this.typeGenerators.put("boolean", new SimplePojoTypeGenerator(ClassName.create(Boolean.TYPE))); }