org.rhq.modules.plugins.jbossas7.json
Class Address

java.lang.Object
  extended by org.rhq.modules.plugins.jbossas7.json.Address

public class Address
extends Object

An address in AS7

Author:
Heiko W. Rupp

Constructor Summary
Address()
          Create an empty address
Address(Address other)
          Construct an Addres by cloning another
Address(String path)
          Construct an Address from a path in the form (key=value)?(,key=value)*
Address(String key, String value)
          Create an Address with an intial path element
 
Method Summary
 void add(Address address)
          Add a whole address to the given path
 void add(String key, String value)
          Add a key value pair to the path
 void addSegment(String segment)
           
 String get(int n)
          Returns the n'th path element of the address
 Address getParent()
          Return the parent Address of the current one.
 String getPath()
          Returns the Address as a string
 boolean isEmpty()
          Indicates if this Address has path elements
 int size()
          Returns the number of path elements of this address
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Address

public Address()
Create an empty address


Address

public Address(String key,
               String value)
Create an Address with an intial path element

Parameters:
key - key part of the path
value - value part of the path

Address

public Address(Address other)
Construct an Addres by cloning another

Parameters:
other - Address to clone

Address

public Address(String path)
Construct an Address from a path in the form (key=value)?(,key=value)*

Parameters:
path - Path string to parse
Method Detail

add

public void add(String key,
                String value)
Add a key value pair to the path

Parameters:
key - Key part of this path element
value - Value part of this path element

addSegment

public void addSegment(String segment)

toString

public String toString()
Overrides:
toString in class Object

getPath

public String getPath()
Returns the Address as a string

Returns:
list of key value pairs for this path

add

public void add(Address address)
Add a whole address to the given path

Parameters:
address - Other address
See Also:
Address(Address)

isEmpty

public boolean isEmpty()
Indicates if this Address has path elements

Returns:
true if the address has no path elements

size

public int size()
Returns the number of path elements of this address

Returns:
the number of path elements of this address

get

public String get(int n)
Returns the n'th path element of the address

Parameters:
n - Number of the wanted path element
Returns:
A string representation of the wanted element

getParent

public Address getParent()
Return the parent Address of the current one. That is the address with one path segment less. If the current address is empty (the root), an empty address is returned.

Returns:
parent Address


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