org.rhq.core.domain.cloud.composite
Class FailoverListComposite

java.lang.Object
  extended by org.rhq.core.domain.cloud.composite.FailoverListComposite
All Implemented Interfaces:
Serializable, Iterator<FailoverListComposite.ServerEntry>

public class FailoverListComposite
extends Object
implements Iterator<FailoverListComposite.ServerEntry>, Serializable

See Also:
Serialized Form

Nested Class Summary
static class FailoverListComposite.ServerEntry
           
 
Constructor Summary
FailoverListComposite(List<FailoverListComposite.ServerEntry> servers)
           
 
Method Summary
 boolean equals(Object obj)
           
 FailoverListComposite.ServerEntry get(int index)
           
 int hashCode()
           
 boolean hasNext()
           
 FailoverListComposite.ServerEntry next()
           
 FailoverListComposite.ServerEntry peek()
          Same as next() except this doesn't move the iterator pointer forward.
static FailoverListComposite readAsText(String text)
          Factory method that takes text generated from a previous instance's writeAsText() string.
 void remove()
           
 void resetIndex()
          Call this method if you want the iterator to start over at the first, topmost, server in the failover list.
 int size()
           
 String toString()
           
 String writeAsText()
          Used to "serialize" this list in a human-readable form (useful for storing the list in a text file that humans can read and potentially edit).
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FailoverListComposite

public FailoverListComposite(List<FailoverListComposite.ServerEntry> servers)
Method Detail

size

public int size()

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<FailoverListComposite.ServerEntry>

next

public FailoverListComposite.ServerEntry next()
Specified by:
next in interface Iterator<FailoverListComposite.ServerEntry>

peek

public FailoverListComposite.ServerEntry peek()
Same as next() except this doesn't move the iterator pointer forward. Calling this method multiple times in a row results in the same server being returned, unlike next(). If you call peek() and then next(), both will return the same server.

Returns:
the server entry that is next on the list to be returned (may be null)

get

public FailoverListComposite.ServerEntry get(int index)

resetIndex

public void resetIndex()
Call this method if you want the iterator to start over at the first, topmost, server in the failover list.


remove

public void remove()
Specified by:
remove in interface Iterator<FailoverListComposite.ServerEntry>

writeAsText

public String writeAsText()
Used to "serialize" this list in a human-readable form (useful for storing the list in a text file that humans can read and potentially edit).

Returns:
the list in a human readable format

readAsText

public static FailoverListComposite readAsText(String text)
Factory method that takes text generated from a previous instance's writeAsText() string.

Parameters:
text - the failover list, in text form
Returns:
a new instance of FailoverListComposite whose servers are found in text

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2008-2011 Red Hat, Inc.. All Rights Reserved.