package org.ovirt.engine.core.compat.backendcompat;

import java.beans.PropertyDescriptor;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

//This will be a wrapper for import java.beans.PropertyDescriptor;
public class PropertyInfo {
    private static Log log = LogFactory.getLog(PropertyInfo.class);

    private PropertyDescriptor pd;

    public PropertyInfo(PropertyDescriptor pd) {
        this.pd = pd;
    }

    public String getName() {
        return pd.getName();
    }

    public Object GetValue(Object obj, Object defaultValue) {
        Object returnValue = null;
        try {
            returnValue = pd.getReadMethod().invoke(obj);
        } catch (Exception e) {
            log.warn("Unable to get value of property: " + pd.getDisplayName() + " for class "
                    + obj.getClass().getName());
        }
        return returnValue == null ? defaultValue : returnValue;
    }

    public boolean getCanWrite() {
        return pd.getWriteMethod() != null;
    }

    public boolean isPropertyInstanceOf(Class<?> clazz) {
        return this.pd.getPropertyType().equals(clazz);
    }
}

package org.ovirt.engine.core.compat.backendcompat;

import java.beans.PropertyDescriptor;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

//This will be a wrapper for import java.beans.PropertyDescriptor;
public class PropertyInfo {
    private static final Log log = LogFactory.getLog(PropertyInfo.class);

    private PropertyDescriptor pd;

    public PropertyInfo(PropertyDescriptor pd) {
        this.pd = pd;
    }

    public String getName() {
        return pd.getName();
    }

    public Object GetValue(Object obj, Object defaultValue) {
        Object returnValue = null;
        try {
            returnValue = pd.getReadMethod().invoke(obj);
        } catch (Exception e) {
            log.warn("Unable to get value of property: " + pd.getDisplayName() + " for class "
                    + obj.getClass().getName());
        }
        return returnValue == null ? defaultValue : returnValue;
    }

    public boolean getCanWrite() {
        return pd.getWriteMethod() != null;
    }

    public boolean isPropertyInstanceOf(Class<?> clazz) {
        return this.pd.getPropertyType().equals(clazz);
    }
}

Fix log modifiers in PropretyInfo
core: Fix log modifiers in PropretyInfo

Fixed PropertyInfo's log to have correct modifiers, as per Java
conventions.

Change-Id: I0a3195d219d601065462f9ecc8a0c467e7561345
Signed-off-by: Allon Mureinik <abc9ddaceaf0c059a5d9bc2aed71f25cb5370dba@redhat.com>
