public static final Set<String> getProperties(Class<?> cls)
    {
        if (cls.isPrimitive() || cls.isAnnotation() || cls.isEnum() || String.class.equals(cls))
        {
            return Collections.EMPTY_SET;
        }
        NavigableSet<String> set = setFor(cls);
        Method[] methods = cls.getMethods();
        for (Method method : methods)
        {
            if ((method.getModifiers() & ModifierMask) == 0)
            {
                String name = method.getName();
                if ((name.startsWith("get") || name.startsWith("is"))
                        && method.getParameterCount() == 0)
                {
                    String property = getProperty(method);
                    Class<?> returnType = method.getReturnType();
                    if (
                            returnType.isArray() ||
                            List.class.isAssignableFrom(returnType)
                            )
                    {
                        set.add(property);
                    }
                    else
                    {
                        if (hasMethod(methods, setter(property)))
                        {
                            set.add(property);
                        }
                    }
                }
            }
        }
        for (Field field : cls.getFields())
        {
            if ((field.getModifiers() & ModifierMask) == 0)
            {
                set.add(field.getName());
            }
        }
        return set;
    }
public static final Set < String > getProperties ( Class < ? > cls ) { if ( cls . isPrimitive ( ) || cls . isAnnotation ( ) || cls . isEnum ( ) || String . class . equals ( cls ) ) { return Collections . EMPTY_SET ; } NavigableSet < String > set = setFor ( cls ) ; Method [ ] methods = cls . getMethods ( ) ; for ( Method method : methods ) { if ( ( method . getModifiers ( ) & ModifierMask ) == 0 ) { String name = method . getName ( ) ; if ( ( name . startsWith ( "get" ) || name . startsWith ( "is" ) ) && method . getParameterCount ( ) == 0 ) { String property = getProperty ( method ) ; Class < ? > returnType = method . getReturnType ( ) ; if ( returnType . isArray ( ) || List . class . isAssignableFrom ( returnType ) ) { set . add ( property ) ; } else { if ( hasMethod ( methods , setter ( property ) ) ) { set . add ( property ) ; } } } } } for ( Field field : cls . getFields ( ) ) { if ( ( field . getModifiers ( ) & ModifierMask ) == 0 ) { set . add ( field . getName ( ) ) ; } } return set ; }
Returns Set of classes patterns.
<p>Annotations XmlAccessorOrder and XmlType are checked for correct ordering.
@param cls
@return
@see javax.xml.bind.annotation.XmlAccessorOrder
@see javax.xml.bind.annotation.XmlType