Subversion Repository Public Repository

litesoft

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.temp.shared.utils;

public class ObjectUtils
{
    public static boolean areEqual( Object o1, Object o2 )
    {
        return (o1 == o2) || ((o1 != null) && o1.equals( o2 ));
    }

    public static <T> T oneOfToStringIgnoreCase( String value, T... options )
    {
        if ( (value != null) && (options != null) )
        {
            for ( T option : options )
            {
                if ( (option != null) && value.equalsIgnoreCase( option.toString() ) )
                {
                    return option;
                }
            }
        }
        return null;
    }

    @SuppressWarnings("unchecked")
    public static <T> T cast( Object object )
    {
        return (T) object;
    }

    public static String simpleClassName( Object object )
    {
        return simpleName( (object == null) ? null : object.getClass() );
    }

    public static String simpleName( Class<?> klass )
    {
        if ( klass == null )
        {
            return null;
        }
        String name = "." + klass.getName() + "$";
        name = name.substring( name.lastIndexOf( '.' ) );
        return name.substring( 0, name.indexOf( '$' ) );
    }
}

Commits for litesoft/trunk/GWT_Sandbox/FormEngine/src/com/temp/shared/utils/ObjectUtils.java

Diff revisions: vs.
Revision Author Commited Message
600 Diff Diff GeorgeS picture GeorgeS Sun 05 Feb, 2012 18:55:58 +0000

Sync-n

593 Diff Diff GeorgeS picture GeorgeS Fri 20 Jan, 2012 21:28:41 +0000
591 GeorgeS picture GeorgeS Fri 20 Jan, 2012 01:57:31 +0000

New FormEngine