org.jpop.util
Class ObjectUtils

java.lang.Object
  extended byorg.jpop.util.ObjectUtils

public class ObjectUtils
extends java.lang.Object

Utilities to transform objects and some other stuff to manipulate them

Version:
1.0
Author:
dsm

Constructor Summary
ObjectUtils()
           
 
Method Summary
static java.lang.String colorToString(java.awt.Color c)
          converts a color to a string that can be used in a properties file
static java.lang.String dimensionToString(java.awt.Dimension d)
          Makes a string from a dimension object
static javax.swing.ImageIcon getImageIcon(java.lang.String classpath)
          Gets the image icon from the classpath provided
static java.io.BufferedReader getReaderFor(java.lang.String classpath)
          Gets a reader for the resource specified
static java.awt.Color parseColor(java.lang.String s)
          parses a string to get a color in the format R:G:B.
static java.awt.Dimension parseDimension(java.lang.String s)
          parses a string to get a dimension in the format W:H.
static java.awt.Point parsePoint(java.lang.String s)
          parses a string to get a point in the format X:Y.
static java.lang.String pointToString(java.awt.Point p)
          Makes a string from a point object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectUtils

public ObjectUtils()
Method Detail

getReaderFor

public static java.io.BufferedReader getReaderFor(java.lang.String classpath)
                                           throws java.io.IOException
Gets a reader for the resource specified

Parameters:
classpath - The classpath to the resource
Returns:
The reader value
Throws:
java.io.IOException

getImageIcon

public static javax.swing.ImageIcon getImageIcon(java.lang.String classpath)
Gets the image icon from the classpath provided

Parameters:
classpath - The classpath from which to get the image
Returns:
The imageIcon value

colorToString

public static java.lang.String colorToString(java.awt.Color c)
converts a color to a string that can be used in a properties file

Parameters:
c - The color to convert
Returns:
A string made of c.getRed():c.getGreen():c.getBlue() or if(c == null){""}

parseColor

public static java.awt.Color parseColor(java.lang.String s)
parses a string to get a color in the format R:G:B. This is used internally to access colors in the properties file

Parameters:
s - The string in the format R:G:B
Returns:
A color described in the string

parseDimension

public static java.awt.Dimension parseDimension(java.lang.String s)
parses a string to get a dimension in the format W:H. This is used internally to access dimensions in the properties file

Parameters:
s - The string in the format W:H
Returns:
A dimension described in the string

parsePoint

public static java.awt.Point parsePoint(java.lang.String s)
parses a string to get a point in the format X:Y. This is used internally to access points in the properties file

Parameters:
s - The string in the format X:Y
Returns:
A point described in the string

pointToString

public static java.lang.String pointToString(java.awt.Point p)
Makes a string from a point object

Parameters:
p - the point
Returns:
the point as a string

dimensionToString

public static java.lang.String dimensionToString(java.awt.Dimension d)
Makes a string from a dimension object

Parameters:
d - the dimension
Returns:
the dimension as a string