net.anidb.udp
Class DataField

java.lang.Object
  extended by net.anidb.udp.DataField

public class DataField
extends java.lang.Object

A data field of an entry of a response or a sub data field of a data field.

Version:
1.0, 29.11.2009
Author:
grizzlyxp (http://anidb.net/perl-bin/animedb.pl?show=userpage&uid=63935)

Method Summary
 DataField getDataFieldAt(int index)
          Returns the sub data field on the given index.
 int getDataFieldCount()
          Returns the count the sub data fields.
 java.lang.String getValue()
          Returns the value.
 java.lang.Boolean getValueAsBoolean()
          Returns the value as a Boolean.
 java.lang.Integer getValueAsInteger()
          Returns the value as an Integer.
 int getValueAsIntegerValue()
          Returns the value as an integer value.
 java.lang.Long getValueAsLong()
          Returns the value as a Long.
 long getValueAsLongValue()
          Returns the value as a long value.
 java.util.List<java.lang.String> getValues()
          Returns the values.
 java.util.List<java.lang.Integer> getValuesAsInteger()
          Returns the values as Integer objects.
 java.util.List<java.lang.Long> getValuesAsLong()
          Returns the values as Long objects.
 boolean hasDataFields()
          Returns the status if this data field has sub fields.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getValue

public java.lang.String getValue()

Returns the value.

If the data field contains more than one value, the values will be returned as one including the seperator characters.

Returns:
The value.

getValueAsIntegerValue

public int getValueAsIntegerValue()
                           throws DataFieldException
Returns the value as an integer value.

Returns:
The integer value.
Throws:
DataFieldException - If the field does not contain a parsable integer.

getValueAsInteger

public java.lang.Integer getValueAsInteger()
                                    throws DataFieldException
Returns the value as an Integer.

Returns:
The Integer.
Throws:
DataFieldException - If the field does not contain a parsable integer.

getValueAsLongValue

public long getValueAsLongValue()
                         throws DataFieldException
Returns the value as a long value.

Returns:
The long value.
Throws:
DataFieldException - If the field does not contain a parsable long.

getValueAsLong

public java.lang.Long getValueAsLong()
                              throws DataFieldException
Returns the value as a Long.

Returns:
The Long.
Throws:
DataFieldException - If the field does not contain a parsable long.

getValueAsBoolean

public java.lang.Boolean getValueAsBoolean()
                                    throws DataFieldException
Returns the value as a Boolean.

Returns:
The Boolean
Throws:
DataFieldException - If the field does not contain a parsable long or does not contain one of the following values: 0 or 1.

getValues

public java.util.List<java.lang.String> getValues()

Returns the values.

If the data field contains only one value, a list with only one element will be returned.

Returns:
The values.

getValuesAsInteger

public java.util.List<java.lang.Integer> getValuesAsInteger()
                                                     throws DataFieldException

Returns the values as Integer objects.

If the data field contains only one value, a list with only one element will be returned.

Returns:
The values of class Integer.
Throws:
DataFieldException - If the field does not contain parsable integer values.

getValuesAsLong

public java.util.List<java.lang.Long> getValuesAsLong()
                                               throws DataFieldException

Returns the values as Long objects.

If the data field contains only one value, a list with only one element will be returned.

Returns:
The values of class Long.
Throws:
DataFieldException - If the field does not contain parsable long values.

hasDataFields

public boolean hasDataFields()
Returns the status if this data field has sub fields.

Returns:
The state: true, if this data field has sub fields, otherwise false.

getDataFieldCount

public int getDataFieldCount()
Returns the count the sub data fields.

Returns:
The count.

getDataFieldAt

public DataField getDataFieldAt(int index)
Returns the sub data field on the given index.

Parameters:
index - The index.
Returns:
The sub data field.
Throws:
java.lang.IndexOutOfBoundsException - If the index is out of bounds.