ccc.api.types
Class Paragraph

java.lang.Object
  extended by ccc.api.types.Paragraph
All Implemented Interfaces:
java.io.Serializable

public final class Paragraph
extends java.lang.Object
implements java.io.Serializable

A paragraph of HTML.

Author:
Civic Computing Ltd
See Also:
Serialized Form

Field Summary
static int MAX_NAME_LENGTH
          MAX_NAME_LENGTH : int.
static int MAX_TEXT_LENGTH
          MAX_TEXT_LENGTH : int.
 
Method Summary
 boolean equals(java.lang.Object obj)
          
static java.lang.String escape(java.lang.String string)
          Escape a html/xhtml string.
static Paragraph fromBoolean(java.lang.String name, java.lang.Boolean b)
          Factory method.
static Paragraph fromDate(java.lang.String name, java.util.Date date)
          Factory method.
static Paragraph fromList(java.lang.String name, java.util.List<java.lang.String> list)
          Factory method.
static Paragraph fromNumber(java.lang.String name, java.math.BigDecimal number)
          Factory method.
static Paragraph fromNumber(java.lang.String name, double number)
          Factory method.
static Paragraph fromNumber(java.lang.String name, long number)
          Factory method.
static Paragraph fromText(java.lang.String name, java.lang.String text)
          Factory method.
 java.lang.Boolean getBoolean()
          Accessor.
 java.util.Date getDate()
          Accessor.
 java.util.List<java.lang.String> getList()
          Accessor.
 java.lang.String getName()
          Accessor.
 java.math.BigDecimal getNumber()
          Accessor.
 java.lang.String getText()
          Accessor.
 ParagraphType getType()
          Accessor.
 int hashCode()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_NAME_LENGTH

public static final int MAX_NAME_LENGTH
MAX_NAME_LENGTH : int.

See Also:
Constant Field Values

MAX_TEXT_LENGTH

public static final int MAX_TEXT_LENGTH
MAX_TEXT_LENGTH : int.

See Also:
Constant Field Values
Method Detail

fromText

public static Paragraph fromText(java.lang.String name,
                                 java.lang.String text)
Factory method. Creates a paragraph representing text.

Parameters:
text - The text for this paragraph.
name - The name of the paragraph.
Returns:
A paragraph with string content.

fromBoolean

public static Paragraph fromBoolean(java.lang.String name,
                                    java.lang.Boolean b)
Factory method. Creates a paragraph representing a boolean.

Parameters:
b - The boolean for this paragraph.
name - The name of the paragraph.
Returns:
A paragraph with boolean content.

fromDate

public static Paragraph fromDate(java.lang.String name,
                                 java.util.Date date)
Factory method. Creates a paragraph representing a date.

Parameters:
date - The date for this paragraph.
name - The name of the paragraph.
Returns:
A paragraph with date content.

fromNumber

public static Paragraph fromNumber(java.lang.String name,
                                   long number)
Factory method. Creates a paragraph representing a number.

Parameters:
number - The number for this paragraph.
name - The name of the paragraph.
Returns:
A paragraph with numerical content.

fromNumber

public static Paragraph fromNumber(java.lang.String name,
                                   double number)
Factory method. Creates a paragraph representing a number.

Parameters:
number - The number for this paragraph.
name - The name of the paragraph.
Returns:
A paragraph with numerical content.

fromNumber

public static Paragraph fromNumber(java.lang.String name,
                                   java.math.BigDecimal number)
Factory method. Creates a paragraph representing a number.

Parameters:
number - The number for this paragraph.
name - The name of the paragraph.
Returns:
A paragraph with numerical content.

fromList

public static Paragraph fromList(java.lang.String name,
                                 java.util.List<java.lang.String> list)
Factory method. Creates a paragraph representing a list of strings.

Parameters:
name - The name of the paragraph.
list - The list for the paragraph.
Returns:
A paragraph with list content.

getNumber

public java.math.BigDecimal getNumber()
Accessor.

Returns:
The numerical representation of this paragraph.

getText

public java.lang.String getText()
Accessor.

Returns:
The string representation of this paragraph.

getType

public ParagraphType getType()
Accessor.

Returns:
The type of this paragraph.

getBoolean

public java.lang.Boolean getBoolean()
Accessor.

Returns:
The boolean representation of this paragraph.

getDate

public java.util.Date getDate()
Accessor.

Returns:
The date representation of this paragraph.

getList

public java.util.List<java.lang.String> getList()
Accessor.

Returns:
The list representation of this paragraph.

getName

public java.lang.String getName()
Accessor.

Returns:
The paragraph's name.

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object

escape

public static java.lang.String escape(java.lang.String string)
Escape a html/xhtml string.

This method converts all HTML 4.01 'markup significant' characters to their equivalent entities, as follows:

    " -> &quot;
    & -> &amp;
    < -> &lt;
    > -> &gt;

Parameters:
string - The string to escape.
Returns:
The escaped string.


Copyright © 2010. All Rights Reserved.