Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.maryanovsky.gwtutils.client
Class Utils

    java.lang.Object
      com.maryanovsky.gwtutils.client.Utils

    public class Utils

extends Object

A general utility class.

Author:
  Maryanovsky Alexander

Constructor Summary
`Utils()`

Method Summary
`static boolean` | `areEqual(List<?> list1, List<?> list2)` Returns whether the two specified lists are equal by value, that is, they contain equal items, in the same order.
`static boolean` | `areEqual(Object o1, Object o2)` Returns whether the two specified objects are equal.
`static String[]` | `clone(String[] arr)` Creates a shallow copy of the specified String array.
`static Map<String,String>` | `dictionaryToMap(Dictionary dictionary)` Converts a `Dictionary` to a regular string-to-string map.
`static boolean` | `getBooleanProperty(JavaScriptObject object, String propertyName)` Returns the specified boolean property of the specified JavaScript object.
`static String` | `getHostname(String url)` Returns the hostname in the specified URL.
`static int` | `getIntProperty(JavaScriptObject object, String propertyName)` Returns the specified integer property of the specified JavaScript object.
`static String` | `getStringProperty(JavaScriptObject object, String propertyName)` Returns the specified string property of the specified JavaScript object.
`static Map<String,String>` | `getUrlParams()` Returns the URL parameters of `window.location`.
`static Map<String,String>` | `getUrlParams(Map<String,String> params)` Adds the URL parameters of `window.location` to specified map and returns it.
`static int` | `hashCode(double d)` Returns the hash code for the specified `double` value.
`static int` | `hashCode(int hash1, int hash2)` Returns a hash code for the two specified hash codes.
`static int` | `hashCode(long l)` Returns the hash code for the specified `long` value.
`static int` | `hashCode(Object o)` Returns a hash code for the specified object, or if the object is `null`, returns 0.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Utils

    public Utils()

Method Detail

### getHostname

    public static String getHostname(String url)

  Returns the hostname in the specified URL. Returns the host page base URL if the URL is relative.

### clone

    public static String[] clone(String[] arr)

  Creates a shallow copy of the specified String array.

### hashCode

    public static int hashCode(Object o)

  Returns a hash code for the specified object, or if the object is `null`, returns 0.

### hashCode

    public static int hashCode(double d)

  Returns the hash code for the specified `double` value.

### hashCode

    public static int hashCode(long l)

  Returns the hash code for the specified `long` value.

### hashCode

    public static int hashCode(int hash1,
                               int hash2)

  Returns a hash code for the two specified hash codes.

### areEqual

    public static boolean areEqual(Object o1,
                                   Object o2)

  Returns whether the two specified objects are equal.

### areEqual

    public static boolean areEqual(List<?> list1,
                                   List<?> list2)

  Returns whether the two specified lists are equal by value, that is, they contain equal items, in the same order. Note that the comparison is not recursive, that is, even if some of the elements in the lists are lists themselves, they are compared using the regular `equals` method.

### getStringProperty

    public static String getStringProperty(JavaScriptObject object,
                                           String propertyName)

  Returns the specified string property of the specified JavaScript object.

### getIntProperty

    public static int getIntProperty(JavaScriptObject object,
                                     String propertyName)

  Returns the specified integer property of the specified JavaScript object.

### getBooleanProperty

    public static boolean getBooleanProperty(JavaScriptObject object,
                                             String propertyName)

  Returns the specified boolean property of the specified JavaScript object.

### getUrlParams

    public static Map<String,String> getUrlParams(Map<String,String> params)

  Adds the URL parameters of `window.location` to specified map and returns it. If a parameter has been specified more than once, only the last value is added to the map.

### getUrlParams

    public static Map<String,String> getUrlParams()

  Returns the URL parameters of `window.location`. The returned map is unmodifiable. If a parameter has been specified more than once, only the last value appears in the map.

### dictionaryToMap

    public static Map<String,String> dictionaryToMap(Dictionary dictionary)

  Converts a `Dictionary` to a regular string-to-string map.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD