Package com.sun.grid.jgdi.configuration.reflect

Examples of com.sun.grid.jgdi.configuration.reflect.ListPropertyDescriptor


                GEObject child = null;
                if (propDescr instanceof SimplePropertyDescriptor) {
                    SimplePropertyDescriptor spd = (SimplePropertyDescriptor) propDescr;
                    child = (GEObject) spd.getValue(root);
                } else if (propDescr instanceof ListPropertyDescriptor) {
                    ListPropertyDescriptor lpd = (ListPropertyDescriptor) propDescr;
                    int propCount = lpd.getCount(root);
                    GEObject tmpChild = null;
                    for (int i = 0; i < propCount; i++) {
                        tmpChild = (GEObject) lpd.get(root, i);
                        if (tmpChild.getName().equals(name)) {
                            child = tmpChild;
                            break;
                        }
                    }
View Full Code Here


                                differences.add(new Difference(propPath, v1 + " != " + v2));
                            }
                        }
                    }
                } else if (pd instanceof ListPropertyDescriptor) {
                    ListPropertyDescriptor lpd = (ListPropertyDescriptor) pd;
                   
                    int count1 = lpd.getCount(obj1);
                    int count2 = lpd.getCount(obj2);
                    if (count1 != count2) {
                        differences.add(new Difference(propPath, "MLPD: different length (" + count1 + " != " + count2 + ")"));
                    } else {
                        for (int valueIndex = 0; valueIndex < count1; valueIndex++) {
                            Object v1 = lpd.get(obj1, valueIndex);
                            Object v2 = lpd.get(obj2, valueIndex);
                           
                            String myPath = propPath + "[" + valueIndex + "]";
                            if (v1 == null && v2 == null) {
                                // do nothing
                            } else if (v1 == null && v2 != null) {
                                differences.add(new Difference(myPath, "MLPD: missing in obj1 (" + v2 + ")"));
                            } else if (v1 != null && v2 == null) {
                                differences.add(new Difference(myPath, "MLPD: missing in obj2 (" + v1 + ")"));
                            } else {
                                if (GEObject.class.isAssignableFrom(lpd.getPropertyType())) {
                                    getDifferences((GEObject) v1, (GEObject) v2, myPath + ".", differences);
                                } else {
                                    if (!v1.equals(v2)) {
                                        differences.add(new Difference(myPath, v1 + " != " + v2));
                                    }
                                }
                            }
                        }
                    }
                } else if (pd instanceof MapListPropertyDescriptor) {
                   
                    MapListPropertyDescriptor lpd = (MapListPropertyDescriptor) pd;
                   
                    Set keys1 = lpd.getKeys(obj1);
                    Set keys2 = lpd.getKeys(obj2);
                    if (keys1.size() != keys2.size()) {
                        differences.add(new Difference(propPath, "MLPD: different key count (" + keys1.size() + " != " + keys2.size() + ")"));
                    } else {
                        Iterator iter = keys1.iterator();
                        while (iter.hasNext()) {
                            Object key = iter.next();
                            String keyPath = propPath + "[" + key + "]";
                            int count1 = lpd.getCount(obj1, key);
                            int count2 = lpd.getCount(obj2, key);
                           
                            if (count1 != count2) {
                                differences.add(new Difference(keyPath, "MLPD: different length (" + count1 + " != " + count2 + ")"));
                            } else {
                                for (int valueIndex = 0; valueIndex < count1; valueIndex++) {
                                    Object v1 = lpd.get(obj1, key, valueIndex);
                                    Object v2 = lpd.get(obj2, key, valueIndex);
                                   
                                    String myPath = keyPath + "[" + valueIndex + "]";
                                    if (v1 == null && v2 == null) {
                                        // do nothing
                                    } else if (v1 == null && v2 != null) {
                                        differences.add(new Difference(myPath, "MPD: missing in obj1 (" + v2 + ")"));
                                    } else if (v1 != null && v2 == null) {
                                        differences.add(new Difference(myPath, "MPD: missing in obj2 (" + v1 + ")"));
                                    } else {
                                        if (GEObject.class.isAssignableFrom(lpd.getPropertyType())) {
                                            getDifferences((GEObject) v1, (GEObject) v2, myPath + ".", differences);
                                        } else {
                                            if (!v1.equals(v2)) {
                                                differences.add(new Difference(myPath, v1 + " != " + v2));
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                } else if (pd instanceof MapPropertyDescriptor) {
                   
                    MapPropertyDescriptor lpd = (MapPropertyDescriptor) pd;
                   
                    Set keys1 = lpd.getKeys(obj1);
                    Set keys2 = lpd.getKeys(obj2);
                   
                    if (keys1.size() != keys2.size()) {
                        differences.add(new Difference(propPath, "MPD: different key count (" + keys1.size() + " != " + keys2.size() + ")"));
                    } else {
                        Iterator iter = keys1.iterator();
                        while (iter.hasNext()) {
                            Object key = iter.next();
                           
                            String keyPath = propPath + "[" + key + "]";
                            Object v1 = lpd.get(obj1, key);
                            Object v2 = lpd.get(obj2, key);
                           
                            if (v1 == null && v2 == null) {
                                // do nothing
                            } else if (v1 == null && v2 != null) {
                                differences.add(new Difference(keyPath, "MPD: missing in obj1 (" + v2 + ")"));
                            } else if (v1 != null && v2 == null) {
                                differences.add(new Difference(keyPath, "MPD: missing in obj2 (" + v1 + ")"));
                            } else {
                                if (GEObject.class.isAssignableFrom(lpd.getPropertyType())) {
                                    getDifferences((GEObject) v1, (GEObject) v2, keyPath + ".", differences);
                                } else {
                                    if (!v1.equals(v2)) {
                                        differences.add(new Difference(keyPath, v1 + " != " + v2));
                                    }
View Full Code Here

TOP

Related Classes of com.sun.grid.jgdi.configuration.reflect.ListPropertyDescriptor

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.