com.splunk.modularinput
Class SingleValueParameter

java.lang.Object
  extended by com.splunk.modularinput.Parameter
      extended by com.splunk.modularinput.SingleValueParameter

public class SingleValueParameter
extends Parameter

The SingleValueParameter class represents a parameter as part of a modular input instance that contains only a single value. This corresponds to XML fragments of the form:

 <param name="param1">value11</param>
 
 


Method Summary
 boolean equals(java.lang.Object other)
           
 boolean getBoolean()
          Tries to coerce the value of this parameter to a Boolean.
 double getDouble()
          Coerces the value of this field to a double.
 float getFloat()
          Coerces the value of this field to a float.
 int getInt()
          Coerces the value of this field to an int.
 long getLong()
          Coerces the value of this field to a long.
 java.lang.String getName()
           
 java.lang.String getValue()
          Returns the parameter as found (as a String), without trying to coerce it to another type.
 int hashCode()
           
 
Methods inherited from class com.splunk.modularinput.Parameter
nodeToParameterList
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getName

public java.lang.String getName()
Specified by:
getName in class Parameter
Returns:
the name of this parameter.

getValue

public java.lang.String getValue()
Returns the parameter as found (as a String), without trying to coerce it to another type. If your field is Boolean or numeric, use getBoolean or one of getInt, getLong, getFloat, and getDouble instead.

Returns:
The value of this parameter as a String.

getBoolean

public boolean getBoolean()
                   throws MalformedDataException
Tries to coerce the value of this parameter to a Boolean. A range of values (true, t, on, 1, y, yes) are interpreted as true, and a similar range (false, f, off, 0, no, n) as false. Everything else, including null, results in a MalformedDataException.

Returns:
The value of this parameter coerced to a Boolean.
Throws:
MalformedDataException - If the value cannot be coerced to a boolean.

getInt

public int getInt()
Coerces the value of this field to an int.

Returns:
An int parsed from this parameter's value.

getLong

public long getLong()
Coerces the value of this field to a long.

Returns:
A long parsed from this parameter's value.

getFloat

public float getFloat()
Coerces the value of this field to a float.

Returns:
A float parsed from this parameter's value.

getDouble

public double getDouble()
Coerces the value of this field to a double.

Returns:
A double parsed from this parameter's value.

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object