Example usage for java.lang Boolean TYPE

List of usage examples for java.lang Boolean TYPE

Introduction

In this page you can find the example usage for java.lang Boolean TYPE.

Prototype

Class TYPE

To view the source code for java.lang Boolean TYPE.

Click Source Link

Document

The Class object representing the primitive type boolean.

Usage

From source file:Main.java

public static void main(String[] args) {
    Class c = boolean.class;
    c = Boolean.TYPE;
    c = byte.class;
    c = Byte.TYPE;//w  ww . jav  a 2  s . c om
    c = char.class;
    c = Character.TYPE;
    c = short.class;
    c = Short.TYPE;
    c = int.class;
    c = Integer.TYPE;
    c = long.class;
    c = Long.TYPE;
    c = float.class;
    c = Float.TYPE;
    c = double.class;
    c = Double.TYPE;
    c = void.class;
    c = Void.TYPE;
}

From source file:org.kuali.rice.devtools.generators.dd.BeanDDCreator.java

/**
 * This method.../*from  ww  w .j  av  a 2 s . com*/
 * @param args
 */
public static void main(String[] args) throws Exception {
    String className = args[0];
    Class<? extends BusinessObject> boClass = (Class<? extends BusinessObject>) Class.forName(className);
    PropertyDescriptor[] props = PropertyUtils.getPropertyDescriptors(boClass);

    StringBuffer sb = new StringBuffer(4000);
    sb.append("<beans xmlns=\"http://www.springframework.org/schema/beans\"\r\n"
            + "    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n"
            + "    xmlns:p=\"http://www.springframework.org/schema/p\"\r\n"
            + "    xsi:schemaLocation=\"http://www.springframework.org/schema/beans\r\n"
            + "        http://www.springframework.org/schema/beans/spring-beans-2.0.xsd\">\r\n" + "\r\n"
            + "  <bean id=\"");
    sb.append(boClass.getSimpleName());
    sb.append("\" parent=\"");
    sb.append(boClass.getSimpleName());
    sb.append("-parentBean\" />\r\n" + "\r\n" + "  <bean id=\"");
    sb.append(boClass.getSimpleName());
    sb.append("-parentBean\" abstract=\"true\" parent=\"BusinessObjectEntry\"\r\n"
            + "        p:businessObjectClass=\"");
    sb.append(boClass.getName());
    sb.append("\"\r\n");
    sb.append("        p:titleAttribute=\"");
    sb.append("FILL ME IN");
    sb.append("\"\r\n");
    sb.append("        p:objectLabel=\"");
    sb.append(camelCaseToString(boClass.getSimpleName()));
    sb.append("\"\r\n");
    sb.append("        p:inquiryDefinition-ref=\"");
    sb.append(boClass.getSimpleName());
    sb.append("-inquiryDefinition\"\r\n");
    sb.append("        p:lookupDefinition-ref=\"");
    sb.append(boClass.getSimpleName());
    sb.append("-lookupDefinition\" >\r\n");
    sb.append("    <property name=\"attributes\" >\r\n" + "      <list>\r\n");
    for (PropertyDescriptor p : props) {
        if (isNormalProperty(p)) {
            sb.append("        <ref bean=\"").append(boClass.getSimpleName()).append('-');
            sb.append(p.getName());
            sb.append("\" />\r\n");
        }
    }

    sb.append("      </list>\r\n" + "    </property>\r\n" + "  </bean>\r\n" + "\r\n");
    for (PropertyDescriptor p : props) {
        if (isNormalProperty(p)) {

            if (p.getName().equals("versionNumber")) {
                sb.append(getSimpleParentBeanReference(boClass, p.getName()));
                sb.append(getSimpleAbstractInheritanceBean(boClass, p.getName(),
                        "GenericAttributes-versionNumber"));

            } else if (p.getName().endsWith("chartOfAccountsCode")) {
                sb.append(getSimpleParentBeanReference(boClass, p.getName()));
                sb.append(getSimpleAbstractInheritanceBean(boClass, p.getName(), "Chart-chartOfAccountsCode"));

            } else if (p.getName().endsWith("organizationCode")) {
                sb.append(getSimpleParentBeanReference(boClass, p.getName()));
                sb.append(getSimpleAbstractInheritanceBean(boClass, p.getName(), "Org-organizationCode"));

            } else if (p.getName().endsWith("accountNumber")) {
                sb.append(getSimpleParentBeanReference(boClass, p.getName()));
                sb.append(getSimpleAbstractInheritanceBean(boClass, p.getName(), "Account-accountNumber"));

            } else if (p.getName().equals("active")) {
                sb.append(getSimpleParentBeanReference(boClass, p.getName()));
                sb.append(getSimpleAbstractInheritanceBean(boClass, p.getName(),
                        "GenericAttributes-activeIndicator"));

            } else if (p.getName().equals("codeAndDescription")) {
                sb.append(getSimpleParentBeanReference(boClass, p.getName()));
                sb.append(getSimpleAbstractInheritanceBeanWithLabel(boClass, p.getName(),
                        "CommonField-CodeAndDescription", camelCaseToString(boClass.getSimpleName())));

            } else if (p.getPropertyType() == Boolean.TYPE) {
                sb.append(getSimpleParentBeanReference(boClass, p.getName()));
                sb.append(getSimpleAbstractInheritanceBean(boClass, p.getName(),
                        "GenericAttributes-genericBoolean"));

            } else {
                // attribute bean
                sb.append(getSimpleParentBeanReference(boClass, p.getName()));
                // attribute parent bean
                sb.append("  <bean id=\"").append(boClass.getSimpleName()).append('-');
                sb.append(p.getName())
                        .append("-parentBean\" parent=\"AttributeDefinition\" abstract=\"true\"\r\n");
                sb.append("        p:name=\"").append(p.getName()).append("\"\r\n");
                sb.append("        p:forceUppercase=\"false\"\r\n");
                sb.append("        p:label=\"").append(camelCaseToString(p.getName())).append("\"\r\n");
                sb.append("        p:shortLabel=\"").append(camelCaseToString(p.getName())).append("\"\r\n");
                sb.append("        p:maxLength=\"10\"\r\n");
                sb.append("        p:required=\"false\" >\r\n");
                sb.append("    <property name=\"validationPattern\" >\r\n"
                        + "      <bean parent=\"AnyCharacterValidationPattern\"\r\n"
                        + "            p:allowWhitespace=\"true\" />\r\n" + "    </property>\r\n"
                        + "    <property name=\"control\" >\r\n"
                        + "      <bean parent=\"TextControlDefinition\"\r\n"
                        + "            p:size=\"10\" />\r\n" + "    </property>\r\n" + "  </bean>\r\n");

            }
            sb.append("\r\n");
        }
    }
    // inquiry definition

    sb.append(getSimpleParentBeanReference(boClass, "inquiryDefinition"));
    sb.append("\r\n");
    sb.append("  <bean id=\"");
    sb.append(boClass.getSimpleName());
    sb.append("-inquiryDefinition-parentBean\" abstract=\"true\" parent=\"InquiryDefinition\"\r\n"
            + "        p:title=\"");
    sb.append(camelCaseToString(boClass.getSimpleName()));
    sb.append(" Inquiry\" >\r\n" + "    <property name=\"inquirySections\" >\r\n" + "      <list>\r\n"
            + "        <bean parent=\"InquirySectionDefinition\"\r\n" + "              p:title=\"");
    sb.append(camelCaseToString(boClass.getSimpleName()));
    sb.append(" Attributes\"\r\n" + "              p:numberOfColumns=\"1\" >\r\n"
            + "          <property name=\"inquiryFields\" >\r\n" + "            <list>\r\n");
    for (PropertyDescriptor p : props) {
        if (isNormalProperty(p)) {
            sb.append("              <bean parent=\"FieldDefinition\" p:attributeName=\"");
            sb.append(p.getName()).append("\" />\r\n");
        }
    }
    sb.append("            </list>\r\n" + "          </property>\r\n" + "        </bean>\r\n"
            + "      </list>\r\n" + "    </property>\r\n" + "  </bean>\r\n" + "\r\n");

    sb.append(getSimpleParentBeanReference(boClass, "lookupDefinition"));
    sb.append("\r\n");
    sb.append("  <bean id=\"");
    sb.append(boClass.getSimpleName());
    sb.append("-lookupDefinition-parentBean\" abstract=\"true\" parent=\"LookupDefinition\"\r\n"
            + "        p:title=\"");
    sb.append(camelCaseToString(boClass.getSimpleName()));
    sb.append(" Lookup\" \r\n");
    //sb.append( "        p:instructions=\"Lookup a " );
    //sb.append( camelCaseToString(boClass.getSimpleName() ) );
    sb.append("\" >\r\n");
    sb.append("    <property name=\"defaultSort\" >\r\n" + "      <bean parent=\"SortDefinition\">\r\n"
            + "        <property name=\"attributeNames\" >\r\n" + "          <list>\r\n"
            + "            <value>FILL ME IN</value>\r\n" + "          </list>\r\n" + "        </property>\r\n"
            + "        <property name=\"sortAscending\" value=\"true\" />\r\n" + "      </bean>\r\n"
            + "    </property>\r\n" + "    <property name=\"lookupFields\" >\r\n" + "      <list>\r\n");
    for (PropertyDescriptor p : props) {
        if (isNormalProperty(p)) {
            sb.append("        <bean parent=\"FieldDefinition\" p:attributeName=\"");
            sb.append(p.getName()).append("\" />\r\n");
        }
    }
    sb.append("      </list>\r\n" + "    </property>\r\n" + "    <property name=\"resultFields\" >\r\n"
            + "      <list>\r\n");
    for (PropertyDescriptor p : props) {
        if (isNormalProperty(p)) {
            sb.append("        <bean parent=\"FieldDefinition\" p:attributeName=\"");
            sb.append(p.getName()).append("\" />\r\n");
        }
    }
    sb.append("      </list>\r\n" + "    </property>\r\n" + "  </bean>\r\n");
    sb.append("\r\n</beans>");
    System.out.println(sb.toString());
}

From source file:Main.java

private static Map<Class<?>, Class<?>> getWrapperTypes() {
    Map<Class<?>, Class<?>> ret = new HashMap<Class<?>, Class<?>>();
    ret.put(Boolean.TYPE, Boolean.class);
    ret.put(Character.TYPE, Character.class);
    ret.put(Byte.TYPE, Byte.class);
    ret.put(Short.TYPE, Short.class);
    ret.put(Integer.TYPE, Integer.class);
    ret.put(Long.TYPE, Long.class);
    ret.put(Float.TYPE, Float.class);
    ret.put(Double.TYPE, Double.class);
    ret.put(Void.TYPE, Void.class);
    return ret;// w  ww  . jav a2s.  c  om
}

From source file:Main.java

public static Class<?> wrapperType(Class<?> paramClass) {
    if (paramClass == Integer.TYPE)
        return Integer.class;
    if (paramClass == Long.TYPE)
        return Long.class;
    if (paramClass == Boolean.TYPE)
        return Boolean.class;
    if (paramClass == Double.TYPE)
        return Double.class;
    if (paramClass == Float.TYPE)
        return Float.class;
    if (paramClass == Byte.TYPE)
        return Byte.class;
    if (paramClass == Short.TYPE)
        return Short.class;
    if (paramClass == Character.TYPE)
        return Character.class;
    throw new IllegalArgumentException("Class " + paramClass.getName() + " is not a primitive type");
}

From source file:Main.java

public static void showInternalDebugLog() {
    try {/* w w w  . j ava 2s . c o  m*/
        Class<?> clz = Class.forName("com.avos.avoscloud.AVOSCloud");
        Method startMethod = clz.getDeclaredMethod("showInternalDebugLog", Boolean.TYPE);
        startMethod.setAccessible(true);
        startMethod.invoke(null, true);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

/**
 * Helper method used to get default value for wrappers used for primitive types
 * (0 for Integer etc)/*ww  w  . j a  v  a 2 s.  c  o m*/
 */
public static Object defaultValue(Class<?> cls) {
    if (cls == Integer.TYPE) {
        return Integer.valueOf(0);
    }
    if (cls == Long.TYPE) {
        return Long.valueOf(0L);
    }
    if (cls == Boolean.TYPE) {
        return Boolean.FALSE;
    }
    if (cls == Double.TYPE) {
        return Double.valueOf(0.0);
    }
    if (cls == Float.TYPE) {
        return Float.valueOf(0.0f);
    }
    if (cls == Byte.TYPE) {
        return Byte.valueOf((byte) 0);
    }
    if (cls == Short.TYPE) {
        return Short.valueOf((short) 0);
    }
    if (cls == Character.TYPE) {
        return '\0';
    }
    throw new IllegalArgumentException("Class " + cls.getName() + " is not a primitive type");
}

From source file:Main.java

/**
 * Helper method for finding wrapper type for given primitive type (why isn't
 * there one in JDK?)//from  w w w .j  a v  a 2s . c  o m
 */
public static Class<?> wrapperType(Class<?> primitiveType) {
    if (primitiveType == Integer.TYPE) {
        return Integer.class;
    }
    if (primitiveType == Long.TYPE) {
        return Long.class;
    }
    if (primitiveType == Boolean.TYPE) {
        return Boolean.class;
    }
    if (primitiveType == Double.TYPE) {
        return Double.class;
    }
    if (primitiveType == Float.TYPE) {
        return Float.class;
    }
    if (primitiveType == Byte.TYPE) {
        return Byte.class;
    }
    if (primitiveType == Short.TYPE) {
        return Short.class;
    }
    if (primitiveType == Character.TYPE) {
        return Character.class;
    }
    throw new IllegalArgumentException("Class " + primitiveType.getName() + " is not a primitive type");
}

From source file:Main.java

/**
 * This method parses the given value into the specified primitive or wrapper class.
 * @param clazz - primitive or wrapper class used to parse
 * @param value - string to be parsed/* w  w  w  . j  a v a  2s.c o m*/
 * @return object of type clazz parsed from the string
 * @author Trisan Bepler
 */
public static Object toObject(Class<?> clazz, String value) {
    if (Boolean.TYPE == clazz)
        return Boolean.parseBoolean(value);
    if (Byte.TYPE == clazz)
        return Byte.parseByte(value);
    if (Short.TYPE == clazz)
        return Short.parseShort(value);
    if (Integer.TYPE == clazz)
        return Integer.parseInt(value);
    if (Long.TYPE == clazz)
        return Long.parseLong(value);
    if (Float.TYPE == clazz)
        return Float.parseFloat(value);
    if (Double.TYPE == clazz)
        return Double.parseDouble(value);
    if (Boolean.class == clazz)
        return Boolean.parseBoolean(value);
    if (Byte.class == clazz)
        return Byte.parseByte(value);
    if (Short.class == clazz)
        return Short.parseShort(value);
    if (Integer.class == clazz)
        return Integer.parseInt(value);
    if (Long.class == clazz)
        return Long.parseLong(value);
    if (Float.class == clazz)
        return Float.parseFloat(value);
    if (Double.class == clazz)
        return Double.parseDouble(value);
    if (Character.class == clazz)
        return value.charAt(0);
    if (Character.TYPE == clazz)
        return value.charAt(0);
    return value;
}

From source file:Main.java

public static void samsungWimax(Context context, boolean state) {
    //http://forum.xda-developers.com/archive/index.php/t-909206.html
    Object samsungWimaxManager = context.getSystemService("WiMax");
    Method setWimaxEnabled = null;
    try {/*ww w .ja  v a 2  s .  co m*/
        setWimaxEnabled = samsungWimaxManager.getClass().getMethod("setWimaxEnabled",
                new Class[] { Boolean.TYPE });
    } catch (Exception e) {
        e.printStackTrace();
    }
    try {
        if (state) {
            setWimaxEnabled.invoke(samsungWimaxManager, new Object[] { Boolean.TRUE });
        } else {
            setWimaxEnabled.invoke(samsungWimaxManager, new Object[] { Boolean.FALSE });
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void removeSysKey(Activity context, EditText paramEditText) {
    if (Build.VERSION.SDK_INT <= 10) {
        paramEditText.setInputType(0);//from w w  w. j  av a  2s . co  m
        return;
    }
    context.getWindow().setSoftInputMode(3);
    try {
        Class[] arrayOfClass = new Class[1];
        arrayOfClass[0] = Boolean.TYPE;
        Method localMethod = EditText.class.getMethod("setShowSoftInputOnFocus", arrayOfClass);
        localMethod.setAccessible(true);
        Object[] arrayOfObject = new Object[1];
        arrayOfObject[0] = Boolean.valueOf(false);
        localMethod.invoke(paramEditText, arrayOfObject);
        return;
    } catch (Exception localException) {
        localException.printStackTrace();
    }
}