FileDocCategorySizeDatePackage
Frame.javaAPI DocGlassfish v2 API5357Fri May 04 22:24:36 BST 2007com.sun.enterprise.config.serverbeans.validation

Frame

public class Frame extends Object
Frame.java
author
Toby H Ferguson
version
$Revision: 1.4 $

Fields Summary
private Map
map
private Frame
parent
Constructors Summary
private Frame()

private Frame(Frame f)

        parent = f;
    
Methods Summary
private booleancontains(java.util.Set s, com.sun.enterprise.config.serverbeans.validation.Frame f)

        for (Iterator it = s.iterator(); it.hasNext();){
            if (it.next() == f) {
                return true;
            }
        }
        return false;
    
private booleanequals(com.sun.enterprise.config.serverbeans.validation.Frame o)

        return o != null
        && (this.map.equals(o.map)
            && ((this.parent == null && o.parent == null) ||
                (this.parent != null  && this.parent.equals(o.parent))));
    
public booleanequals(java.lang.Object o)

        return this == o || (o != null && o instanceof Frame && this.equals((Frame) o));
    
private java.util.SetgetAncestors()

    
      
        if (parent == null){
            return new HashSet();
        } else {
            Set ancestors = parent.getAncestors();
            ancestors.add(this);
            return ancestors;
        }
            
    
public inthashCode()

        return map.hashCode();
    
com.sun.enterprise.config.serverbeans.validation.FrameinheritFrom(com.sun.enterprise.config.serverbeans.validation.Frame f)

        if (contains(getAncestors(),f) || contains(f.getAncestors(),this)){
            throw new IllegalArgumentException("Inheriting from an ancestor is illegal - it causes loops!");
        }
        parent = f;
        return this;
    
java.lang.Stringlookup(java.lang.String s)

        return (map.get(s) != null ? (String) map.get(s) : parent.lookup(s));
    
static com.sun.enterprise.config.serverbeans.validation.FramenewFrame()

        return new Frame(
                new Frame(){
                    String lookup(String s){
                    return (System.getProperty(s) != null
                            ? System.getProperty(s)
                            : "${"+s+"}");
                    }
                    public String toString(){
                        return "[]";
                    }
                }
                );
    
static com.sun.enterprise.config.serverbeans.validation.FramenewFrame(com.sun.enterprise.config.serverbeans.validation.Frame f)

        return new Frame(f);
    
com.sun.enterprise.config.serverbeans.validation.Frameput(java.lang.String key, java.lang.String value)

        map.put(key, value);
        return this;
    
public java.lang.StringtoString()

        StringBuffer sb = new StringBuffer("[");
        for (Iterator it = map.entrySet().iterator(); it.hasNext();){
            Map.Entry e = (Map.Entry) it.next();
            sb.append(e.getKey() + "->" + e.getValue());
            if (it.hasNext()){
                sb.append(", ");
            }
        }
        sb.append(" "+parent +"]");
        return sb.toString();