@Test public void testChain() throws Exception { StringBuilder sb = new StringBuilder(); assertFalse(RenderKitUtils.chain(sb, "", false)); assertTrue(sb.length() == 0); assertFalse(RenderKitUtils.chain(sb, null, false)); assertTrue(sb.length() == 0); assertFalse(RenderKitUtils.chain(sb, "test", false)); assertEquals("test", sb.toString()); assertFalse(RenderKitUtils.chain(sb, "", false)); assertEquals("test", sb.toString()); assertTrue(RenderKitUtils.chain(sb, "another'object", false)); assertEquals("'test','another\\'object'", sb.toString()); assertTrue(RenderKitUtils.chain(sb, "one more", true)); assertEquals("'test','another\\'object','one more'", sb.toString()); }
static boolean chain(StringBuilder sb, Object object, boolean isChained) { if (object != null) { String objectString = object.toString().trim(); if (objectString.length() != 0) { final boolean localIsChained; if (!isChained && sb.length() != 0) { String previousHandlerString = sb.toString(); sb.setLength(0); sb.append("'"); sb.append(escape(previousHandlerString)); sb.append("'"); localIsChained = true; } else { localIsChained = isChained; } if (localIsChained) { sb.append(",'"); sb.append(escape(objectString)); sb.append("'"); return true; } else { sb.append(objectString); return false; } } } return isChained; }
RenderKitUtils { static boolean chain(StringBuilder sb, Object object, boolean isChained) { if (object != null) { String objectString = object.toString().trim(); if (objectString.length() != 0) { final boolean localIsChained; if (!isChained && sb.length() != 0) { String previousHandlerString = sb.toString(); sb.setLength(0); sb.append("'"); sb.append(escape(previousHandlerString)); sb.append("'"); localIsChained = true; } else { localIsChained = isChained; } if (localIsChained) { sb.append(",'"); sb.append(escape(objectString)); sb.append("'"); return true; } else { sb.append(objectString); return false; } } } return isChained; } }
RenderKitUtils { static boolean chain(StringBuilder sb, Object object, boolean isChained) { if (object != null) { String objectString = object.toString().trim(); if (objectString.length() != 0) { final boolean localIsChained; if (!isChained && sb.length() != 0) { String previousHandlerString = sb.toString(); sb.setLength(0); sb.append("'"); sb.append(escape(previousHandlerString)); sb.append("'"); localIsChained = true; } else { localIsChained = isChained; } if (localIsChained) { sb.append(",'"); sb.append(escape(objectString)); sb.append("'"); return true; } else { sb.append(objectString); return false; } } } return isChained; } private  RenderKitUtils(); }
RenderKitUtils { static boolean chain(StringBuilder sb, Object object, boolean isChained) { if (object != null) { String objectString = object.toString().trim(); if (objectString.length() != 0) { final boolean localIsChained; if (!isChained && sb.length() != 0) { String previousHandlerString = sb.toString(); sb.setLength(0); sb.append("'"); sb.append(escape(previousHandlerString)); sb.append("'"); localIsChained = true; } else { localIsChained = isChained; } if (localIsChained) { sb.append(",'"); sb.append(escape(objectString)); sb.append("'"); return true; } else { sb.append(objectString); return false; } } } return isChained; } 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 { static boolean chain(StringBuilder sb, Object object, boolean isChained) { if (object != null) { String objectString = object.toString().trim(); if (objectString.length() != 0) { final boolean localIsChained; if (!isChained && sb.length() != 0) { String previousHandlerString = sb.toString(); sb.setLength(0); sb.append("'"); sb.append(escape(previousHandlerString)); sb.append("'"); localIsChained = true; } else { localIsChained = isChained; } if (localIsChained) { sb.append(",'"); sb.append(escape(objectString)); sb.append("'"); return true; } else { sb.append(objectString); return false; } } } return isChained; } 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);  }