Search this API

y.util
Class YUtil

java.lang.Object
  extended by y.util.YUtil

public final class YUtil
extends java.lang.Object

This class provides some static convenience methods and temporary scratch variables.

 

Method Summary
static boolean getBool(java.lang.Object obj)
          Converts an Object to boolean.
static double getDouble(java.lang.Object obj)
          Converts an Object to double.
static int getInt(java.lang.Object obj)
          Converts an Object to int.
static java.net.URL getURL(java.lang.String relativePath)
          Returns the corresponding absolute URL to the given relative path.
static boolean isDoubleConvertible(java.lang.Object obj)
          Checks if the given Object is convertible to a double value.
static boolean isIntConvertible(java.lang.Object obj)
          Checks if the given Object is convertible to an integer value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getBool

public static boolean getBool(java.lang.Object obj)
Converts an Object to boolean. If the given Object is of type Boolean it's value is returned. Otherwise false is returned.


isIntConvertible

public static boolean isIntConvertible(java.lang.Object obj)
Checks if the given Object is convertible to an integer value.


isDoubleConvertible

public static boolean isDoubleConvertible(java.lang.Object obj)
Checks if the given Object is convertible to a double value.


getInt

public static int getInt(java.lang.Object obj)
Converts an Object to int. If the given Object is of type Integer its value is returned. If the given Object is of type String with an int parsable value, the parsed value is returned. Otherwise 0 is returned.


getDouble

public static double getDouble(java.lang.Object obj)
Converts an Object to double. If the given Object is of type Double its value is returned. If the given Object is of type String with a double parsable value, the parsed value is returned. Otherwise 0.0 is returned.


getURL

public static java.net.URL getURL(java.lang.String relativePath)
Returns the corresponding absolute URL to the given relative path. The given path must be relative to a path or jar in the current classpath.


© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.