Package org.geoserver.ows.util

Examples of org.geoserver.ows.util.ClassProperties


    /**
     * Method which reflectively sets all collections when they are null.
     */
    protected void resolveCollections(Object object) {
        ClassProperties properties = OwsUtils.getClassProperties(object.getClass());
        for (String property : properties.properties()) {
            Method g = properties.getter(property, null);
            if (g == null) {
                continue;
            }

            Class type = g.getReturnType();
            // only continue if this is a collection or a map
            if (!(Map.class.isAssignableFrom(type) || Collection.class.isAssignableFrom(type))) {
                continue;
            }

            // only continue if there is also a setter as well
            Method s = properties.setter(property, null);
            if (s == null) {
                continue;
            }

            // if the getter returns null, call the setter
View Full Code Here


            }
           
            if ( object != null && clazz.isAssignableFrom( object.getClass() ) ) {
                HashMap map = new HashMap();
               
                ClassProperties cp = OwsUtils.getClassProperties(clazz);
                for ( String p : cp.properties() ) {
                    if ( "Class".equals( p ) ) continue;
                    Object value = OwsUtils.get(object, p);
                    if ( value == null ) {
                        value = "null";
                    }
View Full Code Here

   
    /**
     * Method which reflectively sets all collections when they are null.
     */
    protected void resolveCollections(Object object) {
        ClassProperties properties = OwsUtils.getClassProperties( object.getClass() );
        for ( String property : properties.properties() ) {
            Method g = properties.getter( property, null );
            if ( g == null ) {
                continue;
            }
           
            Class type = g.getReturnType();
            //only continue if this is a collection or a map
            if !(Map.class.isAssignableFrom( type ) || Collection.class.isAssignableFrom( type ) ) ) {
                continue;
            }
           
            //only continue if there is also a setter as well
            Method s = properties.setter( property, null );
            if ( s == null ) {
                continue;
            }
           
            //if the getter returns null, call the setter
View Full Code Here

     * <p>
     * Null values from the <tt>update</tt> object are ignored.
     * </p>
     */
    <T> void update( T original, T update, Class<T> clazz ) {
        ClassProperties properties = OwsUtils.getClassProperties( clazz );
        for ( String p : properties.properties() ) {
            Method getter = properties.getter( p, null );
            if ( getter == null ) {
                continue; // should not really happen
            }
           
            Class type = getter.getReturnType();
            Method setter = properties.setter( p, type );
           
            //do a check for read only before calling the getter to avoid an uneccesary call
            if ( setter == null &&
                    !(Collection.class.isAssignableFrom( type ) || Map.class.isAssignableFrom( type ))) {
                //read only
View Full Code Here

            }
           
            if ( object != null && clazz.isAssignableFrom( object.getClass() ) ) {
                HashMap map = new HashMap();
               
                ClassProperties cp = OwsUtils.getClassProperties(clazz);
                for ( String p : cp.properties() ) {
                    if ( "Class".equals( p ) ) continue;
                    Object value = OwsUtils.get(object, p);
                    if ( value == null ) {
                        value = "null";
                    }
View Full Code Here

            LoggingInfo startLogInfo = LoggingStartupContextListener.getLogging(resourceLoader);
           
            // Doing this reflectively so that if LoggingInfo gets new properties, this should still
            // work. KS
           
            ClassProperties properties = OwsUtils.getClassProperties(LoggingInfo.class);
           
            List<String> propertyNames = new ArrayList<String>(properties.properties().size());
            List<Object> newValues = new ArrayList<Object>(properties.properties().size());
            List<Object> oldValues = new ArrayList<Object>(properties.properties().size());
           
            final Level propertyTableLevel = Level.FINE;
            LOGGER.log(propertyTableLevel, "Checking Logging configuration in case it neeeds to be reinitialized");
            for (String propName : properties.properties()) {
               
                // Don't care about the return type
                Method read = properties.getter(propName, null);
               
                Object newVal = read.invoke(realLogInfo);
                Object oldVal = read.invoke(startLogInfo);
               
                if((newVal==null && oldVal==null) || (newVal!=null && newVal.equals(oldVal))) {
View Full Code Here

    private void addDirectPropertyTypes(final Class<? extends Info> clazz,
            final NamedParameterJdbcOperations template) {

        log("Creating property mappings for " + clazz.getName());

        final ClassProperties classProperties = new ClassProperties(clazz);

        List<String> properties = Lists.newArrayList(classProperties.properties());
        Collections.sort(properties);

        for (String propertyName : properties) {
            propertyName = fixCase(propertyName);
            Method getter = classProperties.getter(propertyName, null);
            if (getter == null) {
                continue;
            }

            Class<?> returnType = getter.getReturnType();
View Full Code Here

            }
           
            if ( object != null && clazz.isAssignableFrom( object.getClass() ) ) {
                HashMap map = new HashMap();
               
                ClassProperties cp = OwsUtils.getClassProperties(clazz);
                for ( String p : cp.properties() ) {
                    if ( "Class".equals( p ) ) continue;
                    Object value = OwsUtils.get(object, p);
                    if ( value == null ) {
                        value = "null";
                    }
View Full Code Here

   
    /**
     * Method which reflectively sets all collections when they are null.
     */
    protected void resolveCollections(Object object) {
        ClassProperties properties = OwsUtils.getClassProperties( object.getClass() );
        for ( String property : properties.properties() ) {
            Method g = properties.getter( property, null );
            if ( g == null ) {
                continue;
            }
           
            Class type = g.getReturnType();
            //only continue if this is a collection or a map
            if !(Map.class.isAssignableFrom( type ) || Collection.class.isAssignableFrom( type ) ) ) {
                continue;
            }
           
            //only continue if there is also a setter as well
            Method s = properties.setter( property, null );
            if ( s == null ) {
                continue;
            }
           
            //if the getter returns null, call the setter
View Full Code Here

TOP

Related Classes of org.geoserver.ows.util.ClassProperties

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.