@Test public void testIsEmpty() throws Exception { assertTrue(utils.isEmpty(null)); assertFalse(utils.isEmpty(new Object())); assertFalse(utils.isEmpty(Boolean.FALSE)); assertFalse(utils.isEmpty(Long.valueOf(0))); assertFalse(utils.isEmpty(Integer.valueOf(0))); assertFalse(utils.isEmpty(Short.valueOf((short) 0))); assertFalse(utils.isEmpty(Byte.valueOf((byte) 0))); assertTrue(utils.isEmpty("")); assertFalse(utils.isEmpty("s")); assertTrue(utils.isEmpty(new ArrayList<Object>())); assertTrue(utils.isEmpty(Collections.EMPTY_LIST)); List<Object> testList = new ArrayList<Object>(); testList.add("x"); assertFalse(utils.isEmpty(testList)); assertTrue(utils.isEmpty(new HashMap<String, Object>())); assertTrue(utils.isEmpty(Collections.EMPTY_MAP)); Map<String, Object> testMap = new HashMap<String, Object>(); testMap.put("x", "y"); assertFalse(utils.isEmpty(testMap)); assertTrue(utils.isEmpty(new Object[0])); assertTrue(utils.isEmpty(new int[0])); assertFalse(utils.isEmpty(new Object[1])); assertFalse(utils.isEmpty(new int[1])); }
public boolean isEmpty(Object o) { if (null == o) { return true; } if (o instanceof String) { return 0 == ((String) o).length(); } if (o instanceof Collection<?>) { return ((Collection<?>) o).isEmpty(); } if (o instanceof Map<?, ?>) { return ((Map<?, ?>) o).isEmpty(); } if (o.getClass().isArray()) { return Array.getLength(o) == 0; } return false; }
RendererUtils { public boolean isEmpty(Object o) { if (null == o) { return true; } if (o instanceof String) { return 0 == ((String) o).length(); } if (o instanceof Collection<?>) { return ((Collection<?>) o).isEmpty(); } if (o instanceof Map<?, ?>) { return ((Map<?, ?>) o).isEmpty(); } if (o.getClass().isArray()) { return Array.getLength(o) == 0; } return false; } }
RendererUtils { public boolean isEmpty(Object o) { if (null == o) { return true; } if (o instanceof String) { return 0 == ((String) o).length(); } if (o instanceof Collection<?>) { return ((Collection<?>) o).isEmpty(); } if (o instanceof Map<?, ?>) { return ((Map<?, ?>) o).isEmpty(); } if (o.getClass().isArray()) { return Array.getLength(o) == 0; } return false; } protected  RendererUtils(); }
RendererUtils { public boolean isEmpty(Object o) { if (null == o) { return true; } if (o instanceof String) { return 0 == ((String) o).length(); } if (o instanceof Collection<?>) { return ((Collection<?>) o).isEmpty(); } if (o instanceof Map<?, ?>) { return ((Map<?, ?>) o).isEmpty(); } if (o.getClass().isArray()) { return Array.getLength(o) == 0; } return false; } protected  RendererUtils(); static RendererUtils getInstance(); void encodeId(FacesContext context, UIComponent component); void encodeId(FacesContext context, UIComponent component, String attribute); void encodeCustomId(FacesContext context, UIComponent component); Object createParameterValue(UIParameter parameter); Map<String, Object> createParametersMap(FacesContext context, UIComponent component); void encodePassThru(FacesContext context, UIComponent component, String defaultHtmlEvent); void encodePassThruWithExclusions(FacesContext context, UIComponent component, String exclusions,
        String defaultHtmlEvent); void encodePassThruWithExclusionsArray(FacesContext context, UIComponent component, String[] exclusions,
        String defaultHtmlEvent); void encodePassThruAttribute(FacesContext context, Map<String, Object> attributes, ResponseWriter writer,
        String attribute); void encodeAttributesFromArray(FacesContext context, UIComponent component, String[] attrs); void encodeAttributes(FacesContext context, UIComponent component, String attrs); void encodeAttribute(FacesContext context, UIComponent component, Object property, String attributeName); void encodeAttribute(FacesContext context, UIComponent component, String attribute); boolean isEmpty(Object o); boolean isBooleanAttribute(UIComponent component, String name); String encodePx(String value); String encodePctOrPx(String value); UIComponent getNestingForm(UIComponent component); @Deprecated UIComponent getNestingForm(FacesContext context, UIComponent component); boolean isForm(UIComponent component); UIComponent getSubmittedForm(FacesContext facesContext); boolean isFormSubmitted(FacesContext context, UIForm form); void encodeBeginFormIfNessesary(FacesContext context, UIComponent component); void encodeBeginForm(FacesContext context, UIComponent component, ResponseWriter writer, String clientId); void encodeEndFormIfNessesary(FacesContext context, UIComponent component); static void writeState(FacesContext context); void encodeEndForm(FacesContext context, ResponseWriter writer); String getActionUrl(FacesContext facesContext); String clientId(FacesContext context, UIComponent component); void writeScript(FacesContext context, UIComponent component, Object script); String correctForIdReference(String forAttr, UIComponent component); void encodeChildren(FacesContext context, UIComponent component); boolean hasExplicitId(UIComponent component); @Deprecated UIComponent findComponentFor(FacesContext context, UIComponent component, String id); UIComponent findComponentFor(UIComponent component, String id); }
RendererUtils { public boolean isEmpty(Object o) { if (null == o) { return true; } if (o instanceof String) { return 0 == ((String) o).length(); } if (o instanceof Collection<?>) { return ((Collection<?>) o).isEmpty(); } if (o instanceof Map<?, ?>) { return ((Map<?, ?>) o).isEmpty(); } if (o.getClass().isArray()) { return Array.getLength(o) == 0; } return false; } protected  RendererUtils(); static RendererUtils getInstance(); void encodeId(FacesContext context, UIComponent component); void encodeId(FacesContext context, UIComponent component, String attribute); void encodeCustomId(FacesContext context, UIComponent component); Object createParameterValue(UIParameter parameter); Map<String, Object> createParametersMap(FacesContext context, UIComponent component); void encodePassThru(FacesContext context, UIComponent component, String defaultHtmlEvent); void encodePassThruWithExclusions(FacesContext context, UIComponent component, String exclusions,
        String defaultHtmlEvent); void encodePassThruWithExclusionsArray(FacesContext context, UIComponent component, String[] exclusions,
        String defaultHtmlEvent); void encodePassThruAttribute(FacesContext context, Map<String, Object> attributes, ResponseWriter writer,
        String attribute); void encodeAttributesFromArray(FacesContext context, UIComponent component, String[] attrs); void encodeAttributes(FacesContext context, UIComponent component, String attrs); void encodeAttribute(FacesContext context, UIComponent component, Object property, String attributeName); void encodeAttribute(FacesContext context, UIComponent component, String attribute); boolean isEmpty(Object o); boolean isBooleanAttribute(UIComponent component, String name); String encodePx(String value); String encodePctOrPx(String value); UIComponent getNestingForm(UIComponent component); @Deprecated UIComponent getNestingForm(FacesContext context, UIComponent component); boolean isForm(UIComponent component); UIComponent getSubmittedForm(FacesContext facesContext); boolean isFormSubmitted(FacesContext context, UIForm form); void encodeBeginFormIfNessesary(FacesContext context, UIComponent component); void encodeBeginForm(FacesContext context, UIComponent component, ResponseWriter writer, String clientId); void encodeEndFormIfNessesary(FacesContext context, UIComponent component); static void writeState(FacesContext context); void encodeEndForm(FacesContext context, ResponseWriter writer); String getActionUrl(FacesContext facesContext); String clientId(FacesContext context, UIComponent component); void writeScript(FacesContext context, UIComponent component, Object script); String correctForIdReference(String forAttr, UIComponent component); void encodeChildren(FacesContext context, UIComponent component); boolean hasExplicitId(UIComponent component); @Deprecated UIComponent findComponentFor(FacesContext context, UIComponent component, String id); UIComponent findComponentFor(UIComponent component, String id); static final String DUMMY_FORM_ID; }