com.opera.core.systems
Class OperaArguments

java.lang.Object
  extended by com.opera.core.systems.OperaArguments
All Implemented Interfaces:
OperaArguments, Iterable<OperaArgument>
Direct Known Subclasses:
OperaCoreArguments

public class OperaArguments
extends Object
implements OperaArguments


Field Summary
protected  List<OperaArgument> arguments
           
static String DEFAULT_SIGN
           
 
Constructor Summary
OperaArguments()
          Provides a key/value storage of arguments related to the Opera product binary.
OperaArguments(String spaceDelimitedArguments)
          Provide a space delimited list of arguments as a string that will be parsed and used as the default values for this storage.
 
Method Summary
 void add(OperaArgument argument)
          Adds a new argument to the command-line argument list representation.
 void add(String key)
          Adds a new argument to the command-line argument list representation.
 void add(String key, String value)
          Adds a new argument with a value to the command-line argument list representation.
 OperaArgument get(int index)
          Convenience method to access the given indexed argument in the command-line list representation.
 List<OperaArgument> getArguments()
          Gets the list of all arguments, each represented by OperaArgument.
 List<String> getArgumentsAsStringList()
          Gets all arguments as a string list, including the argument's values.
 Iterator<OperaArgument> iterator()
          Gets an iterator for all arguments present in this collection.
 OperaArguments merge(OperaArguments extraArguments)
          Merge this command-line list representation with another representation.
static OperaArguments parse(String string)
           
 String sign()
          Gets the command-line argument sign used by this implementation of OperaArguments.
 int size()
          Fetches the number of arguments in the command-line list representation.
 org.json.JSONObject toJson()
          Converts this instance to its JSON representation.
 String toString()
          Gets the string representation of the command-line, as it would be used externally.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_SIGN

public static String DEFAULT_SIGN

arguments

protected List<OperaArgument> arguments
Constructor Detail

OperaArguments

public OperaArguments()
Provides a key/value storage of arguments related to the Opera product binary.


OperaArguments

public OperaArguments(String spaceDelimitedArguments)
Provide a space delimited list of arguments as a string that will be parsed and used as the default values for this storage.

Parameters:
spaceDelimitedArguments - list of arguments, as they would appear in a terminal
Method Detail

add

public void add(String key)
Description copied from interface: OperaArguments
Adds a new argument to the command-line argument list representation. A new OperaArgument will be created with an empty value.

Specified by:
add in interface OperaArguments
Parameters:
key - the argument key to add

add

public void add(String key,
                String value)
Description copied from interface: OperaArguments
Adds a new argument with a value to the command-line argument list representation. A new OperaArgument will be created with specified value.

Specified by:
add in interface OperaArguments
Parameters:
key - the argument key to add
value - the value the argument should hold

add

public void add(OperaArgument argument)
Description copied from interface: OperaArguments
Adds a new argument to the command-line argument list representation. The OperaArgument can optionally hold a value.

Specified by:
add in interface OperaArguments
Parameters:
argument - the argument to add

get

public OperaArgument get(int index)
Description copied from interface: OperaArguments
Convenience method to access the given indexed argument in the command-line list representation. This maps to OperaArguments.getArguments().get(x).

Specified by:
get in interface OperaArguments
Parameters:
index - the argument to fetch
Returns:
an argument

getArguments

public List<OperaArgument> getArguments()
Description copied from interface: OperaArguments
Gets the list of all arguments, each represented by OperaArgument.

Specified by:
getArguments in interface OperaArguments
Returns:
list of all arguments

iterator

public Iterator<OperaArgument> iterator()
Description copied from interface: OperaArguments
Gets an iterator for all arguments present in this collection.

Specified by:
iterator in interface OperaArguments
Specified by:
iterator in interface Iterable<OperaArgument>
Returns:
iterator of all arguments

getArgumentsAsStringList

public List<String> getArgumentsAsStringList()
Description copied from interface: OperaArguments
Gets all arguments as a string list, including the argument's values.

Specified by:
getArgumentsAsStringList in interface OperaArguments
Returns:
list of all arguments, including values

toString

public String toString()
Description copied from interface: OperaArguments
Gets the string representation of the command-line, as it would be used externally.

Specified by:
toString in interface OperaArguments
Overrides:
toString in class Object
Returns:
full command-line including argument keys and values

size

public int size()
Description copied from interface: OperaArguments
Fetches the number of arguments in the command-line list representation. Convenience method for OperaArguments.getArguments().size().

Specified by:
size in interface OperaArguments
Returns:
number of arguments (not including values)

parse

public static OperaArguments parse(String string)

merge

public final OperaArguments merge(OperaArguments extraArguments)
Description copied from interface: OperaArguments
Merge this command-line list representation with another representation. Note that this will alter the state of the current object as it does not return a new OperaArguments object.

Specified by:
merge in interface OperaArguments
Parameters:
extraArguments - the OperaArguments to merge into this
Returns:
a reference to self

sign

public String sign()
Description copied from interface: OperaArguments
Gets the command-line argument sign used by this implementation of OperaArguments. Depending on which implementation (OperaCoreArguments, OperaDesktopArguments) you are using, you will get a OperaArgument.OperaArgumentSign.

Specified by:
sign in interface OperaArguments
Returns:
a command-line argument sign
See Also:
OperaArgument.OperaArgumentSign

toJson

public org.json.JSONObject toJson()
                           throws org.json.JSONException
Converts this instance to its JSON representation.

Returns:
the JSON representation of these settings
Throws:
org.json.JSONException - if an error occurs while encoding these settings as JSON


Copyright © 2012. All Rights Reserved.