@Test public void testShouldRenderAttribute() throws Exception { assertFalse(RenderKitUtils.shouldRenderAttribute(null)); assertFalse(RenderKitUtils.shouldRenderAttribute("")); assertTrue(RenderKitUtils.shouldRenderAttribute("test")); assertTrue(RenderKitUtils.shouldRenderAttribute(new Object())); assertTrue(RenderKitUtils.shouldRenderAttribute(Long.valueOf(10))); assertTrue(RenderKitUtils.shouldRenderAttribute(Long.valueOf(0))); assertFalse(RenderKitUtils.shouldRenderAttribute(Long.MIN_VALUE)); assertTrue(RenderKitUtils.shouldRenderAttribute(Integer.valueOf(10))); assertTrue(RenderKitUtils.shouldRenderAttribute(Integer.valueOf(0))); assertFalse(RenderKitUtils.shouldRenderAttribute(Integer.MIN_VALUE)); assertTrue(RenderKitUtils.shouldRenderAttribute(Short.valueOf((short) 10))); assertTrue(RenderKitUtils.shouldRenderAttribute(Short.valueOf((short) 0))); assertFalse(RenderKitUtils.shouldRenderAttribute(Short.MIN_VALUE)); assertTrue(RenderKitUtils.shouldRenderAttribute(Character.valueOf('a'))); assertTrue(RenderKitUtils.shouldRenderAttribute(Character.valueOf((char) 13))); assertFalse(RenderKitUtils.shouldRenderAttribute(Character.MIN_VALUE)); assertTrue(RenderKitUtils.shouldRenderAttribute(Byte.valueOf((byte) 10))); assertTrue(RenderKitUtils.shouldRenderAttribute(Byte.valueOf((byte) 0))); assertFalse(RenderKitUtils.shouldRenderAttribute(Byte.MIN_VALUE)); assertTrue(RenderKitUtils.shouldRenderAttribute(Double.valueOf(10))); assertTrue(RenderKitUtils.shouldRenderAttribute(Double.valueOf(0))); assertFalse(RenderKitUtils.shouldRenderAttribute(Double.MIN_VALUE)); assertTrue(RenderKitUtils.shouldRenderAttribute(Float.valueOf(10))); assertTrue(RenderKitUtils.shouldRenderAttribute(Float.valueOf(0))); assertFalse(RenderKitUtils.shouldRenderAttribute(Float.MIN_VALUE)); assertTrue(RenderKitUtils.shouldRenderAttribute(Boolean.TRUE)); assertFalse(RenderKitUtils.shouldRenderAttribute(Boolean.FALSE)); }
public static boolean shouldRenderAttribute(Object attributeValue) { if (!isAttributeSet(attributeValue)) { return false; } if (attributeValue instanceof Boolean && Boolean.FALSE.equals(attributeValue)) { return false; } return attributeValue.toString().length() > 0; }
RenderKitUtils { public static boolean shouldRenderAttribute(Object attributeValue) { if (!isAttributeSet(attributeValue)) { return false; } if (attributeValue instanceof Boolean && Boolean.FALSE.equals(attributeValue)) { return false; } return attributeValue.toString().length() > 0; } }
RenderKitUtils { public static boolean shouldRenderAttribute(Object attributeValue) { if (!isAttributeSet(attributeValue)) { return false; } if (attributeValue instanceof Boolean && Boolean.FALSE.equals(attributeValue)) { return false; } return attributeValue.toString().length() > 0; } private  RenderKitUtils(); }
RenderKitUtils { public static boolean shouldRenderAttribute(Object attributeValue) { if (!isAttributeSet(attributeValue)) { return false; } if (attributeValue instanceof Boolean && Boolean.FALSE.equals(attributeValue)) { return false; } return attributeValue.toString().length() > 0; } private  RenderKitUtils(); static String[] asArray(Object object); static boolean shouldRenderAttribute(Object attributeValue); static String prefixAttributeName(String attributeName, boolean isXhtmlMode); static String prefixAttributeName(String attributeName, ResponseWriter responseWriter); static void renderAttribute(FacesContext facesContext, String attributeName, Object attributeValue); static Object getAttributeAndBehaviorsValue(FacesContext facesContext, UIComponent component,
            ComponentAttribute componentAttribute); static void renderAttributeAndBehaviors(FacesContext facesContext, UIComponent component,
            ComponentAttribute componentAttribute); static void renderPassThroughAttributesOptimized(FacesContext context, UIComponent component,
            Map<String, ComponentAttribute> knownAttributesMap); static void renderPassThroughAttributes(FacesContext context, UIComponent component,
            Map<String, ComponentAttribute> knownAttributesMap); static void renderPassThroughAttributes(FacesContext context, UIComponent component,
            Collection<ComponentAttribute> attributes); static String decodeBehaviors(FacesContext context, UIComponent component); static Attributes attributes(); static Attributes attributes(Enum<?>... attrs); static Attributes attributes(String... attrs); static void addToScriptHash(Map<String, Object> hash, String name, Object value); static void addToScriptHash(Map<String, Object> hash, String name, Object value, Object defaultValue); static void addToScriptHash(Map<String, Object> hash, String name, Object value, Object defaultValue,
            ScriptHashVariableWrapper wrapper); static void addToScriptHash(Map<String, Object> hash, FacesContext facesContext, UIComponent component,
            Attributes attributes, ScriptHashVariableWrapper wrapper); static String toScriptArgs(Object... objects); static String getResourcePath(FacesContext context, String library, String resourceName); static String getResourceURL(String url, FacesContext context); static Object getFirstNonEmptyAttribute(String attributeName, UIComponent component); static Object getFirstNonEmptyAttribute(String attributeName, UIComponent componentA, UIComponent componentB); static Object getFirstNonEmptyAttribute(String attributeName, UIComponent... components); static String getBehaviorSourceId(FacesContext facesContext); static boolean hasFacet(UIComponent component, String facetName); @SuppressWarnings("unchecked") static T evaluateAttribute(String attribute, UIComponent component, FacesContext context); }
RenderKitUtils { public static boolean shouldRenderAttribute(Object attributeValue) { if (!isAttributeSet(attributeValue)) { return false; } if (attributeValue instanceof Boolean && Boolean.FALSE.equals(attributeValue)) { return false; } return attributeValue.toString().length() > 0; } private  RenderKitUtils(); static String[] asArray(Object object); static boolean shouldRenderAttribute(Object attributeValue); static String prefixAttributeName(String attributeName, boolean isXhtmlMode); static String prefixAttributeName(String attributeName, ResponseWriter responseWriter); static void renderAttribute(FacesContext facesContext, String attributeName, Object attributeValue); static Object getAttributeAndBehaviorsValue(FacesContext facesContext, UIComponent component,
            ComponentAttribute componentAttribute); static void renderAttributeAndBehaviors(FacesContext facesContext, UIComponent component,
            ComponentAttribute componentAttribute); static void renderPassThroughAttributesOptimized(FacesContext context, UIComponent component,
            Map<String, ComponentAttribute> knownAttributesMap); static void renderPassThroughAttributes(FacesContext context, UIComponent component,
            Map<String, ComponentAttribute> knownAttributesMap); static void renderPassThroughAttributes(FacesContext context, UIComponent component,
            Collection<ComponentAttribute> attributes); static String decodeBehaviors(FacesContext context, UIComponent component); static Attributes attributes(); static Attributes attributes(Enum<?>... attrs); static Attributes attributes(String... attrs); static void addToScriptHash(Map<String, Object> hash, String name, Object value); static void addToScriptHash(Map<String, Object> hash, String name, Object value, Object defaultValue); static void addToScriptHash(Map<String, Object> hash, String name, Object value, Object defaultValue,
            ScriptHashVariableWrapper wrapper); static void addToScriptHash(Map<String, Object> hash, FacesContext facesContext, UIComponent component,
            Attributes attributes, ScriptHashVariableWrapper wrapper); static String toScriptArgs(Object... objects); static String getResourcePath(FacesContext context, String library, String resourceName); static String getResourceURL(String url, FacesContext context); static Object getFirstNonEmptyAttribute(String attributeName, UIComponent component); static Object getFirstNonEmptyAttribute(String attributeName, UIComponent componentA, UIComponent componentB); static Object getFirstNonEmptyAttribute(String attributeName, UIComponent... components); static String getBehaviorSourceId(FacesContext facesContext); static boolean hasFacet(UIComponent component, String facetName); @SuppressWarnings("unchecked") static T evaluateAttribute(String attribute, UIComponent component, FacesContext context);  }