title: JSF2: limiting cc:attribute to a given object type within a List
body: <p>If I had a managed bean as follows:</p>
  
  <pre><code>@ManagedBean
  @RequestSchoped
  public class Example {
  
      private List&lt;String&gt; stringList;
      private List&lt;Long&gt; longList;
  
      // getters, setters, etc. down here
  }
  </code></pre>
  
  <p>and had a custom component which accepted a List as an attribute:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8' ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:cc="http://java.sun.com/jsf/composite"
        xmlns:h="http://java.sun.com/jsf/html"&gt;
  
    &lt;!-- INTERFACE --&gt;
    &lt;cc:interface&gt;
        &lt;cc:attribute name="aList" type="java.util.List" /&gt;
    &lt;/cc:interface&gt;
  
    &lt;cc:implementation&gt;
        &lt;!-- code is in here --&gt;
    &lt;/cc:implementation&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>How could I make sure that this worked:</p>
  
  <pre><code>&lt;myComp:previousComponent aList="#{example.stringList}" /&gt;
  </code></pre>
  
  <p>but this didn't:</p>
  
  <pre><code>&lt;myComp:previousComponent aList="#{example.longList}" /&gt;
  </code></pre>
  
  <p>In other words, what I want to do for the <code>cc:attribute</code> is as follows:</p>
  
  <pre><code>&lt;cc:attribute name="aList" type="java.util.List&lt;java.lang.String&gt;" /&gt;
  </code></pre>
  
  <p>However, as we know xhtml doesn't take kindly to using &gt; or &lt;.  Also, with Generics only being checked at compile time, I'm not sure how this would be done.  Does anyone know if this is possible?</p>