commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgra...@apache.org
Subject cvs commit: jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources MessageList.java
Date Mon, 22 Sep 2003 00:25:12 GMT
dgraham     2003/09/21 17:25:12

  Modified:    resources/src/java/org/apache/commons/resources/impl
                        BasicMessageList.java
               resources/src/java/org/apache/commons/resources
                        MessageList.java
  Log:
  Added isAccessed() to interface to determine if the
  MessageList's messages have been retrieved one or
  more times.
  
  Revision  Changes    Path
  1.6       +20 -7     jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/BasicMessageList.java
  
  Index: BasicMessageList.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/BasicMessageList.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BasicMessageList.java	19 Aug 2003 23:34:22 -0000	1.5
  +++ BasicMessageList.java	22 Sep 2003 00:25:12 -0000	1.6
  @@ -94,10 +94,15 @@
               return ((MessageItem) o1).getOrder() - ((MessageItem) o2).getOrder();
           }
       };
  +    
  +    /**
  +     * Have the messages been retrieved from this object?
  +     */
  +    private boolean accessed = false;
   
       /**
        * The accumulated set of <code>Message</code> objects (represented
  -     * as an ArrayList) for each property, keyed by property name.
  +     * as a List) for each property, keyed by property name.
        */
       protected HashMap messages = new HashMap();
   
  @@ -213,6 +218,11 @@
       public void clear() {
           messages.clear();
       }
  +    
  +    // See interface for JavaDoc
  +    public boolean isAccessed() {
  +        return this.accessed;
  +    }
   
       // See interface for JavaDoc
       public boolean isEmpty() {
  @@ -221,7 +231,8 @@
   
       // See interface for JavaDoc
       public Iterator get() {
  -
  +        this.accessed = true;
  +        
           if (messages.isEmpty()) {
               return Collections.EMPTY_LIST.iterator();
           }
  @@ -250,8 +261,10 @@
   
       // See interface for JavaDoc
       public Iterator get(String property) {
  -
  +        this.accessed = true;
  +        
           MessageItem item = (MessageItem) messages.get(property);
  +        
           return (item == null)
               ? Collections.EMPTY_LIST.iterator()
               : item.getList().iterator();
  
  
  
  1.5       +13 -4     jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/MessageList.java
  
  Index: MessageList.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/MessageList.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MessageList.java	19 Aug 2003 23:35:00 -0000	1.4
  +++ MessageList.java	22 Sep 2003 00:25:12 -0000	1.5
  @@ -145,6 +145,15 @@
        * Clear all messages recorded by this object.
        */
       public void clear();
  +    
  +    /**
  +     * Determines if the MessageList's messages have been accessed one or more
  +     * times.  Returns <code>true</code> if the <code>get()</code>
or 
  +     * <code>get(String)</code> methods are called.  
  +     * @return <code>true</code> if the messages have been accessed one or
more
  +     * times.
  +     */
  +    public boolean isAccessed();
   
       /**
        * Return <code>true</code> if there are no messages recorded
  
  
  

Mime
View raw message