A method to find property in subproperties added.
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7749 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
975d9591a2
commit
ccf1242112
@ -197,6 +197,36 @@ public class Properties implements Cloneable, Savable {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method returns the same as getValue if the current property is of
|
||||||
|
* other type than IDP_GROUP and its name matches 'propertyName' param. If
|
||||||
|
* this property is a group property the method tries to find subproperty
|
||||||
|
* value of the given name. The first found value is returnes os <b>use this
|
||||||
|
* method wisely</b>. If no property of a given name is foung - <b>null</b>
|
||||||
|
* is returned.
|
||||||
|
*
|
||||||
|
* @param propertyName
|
||||||
|
* the name of the property
|
||||||
|
* @return found property value or <b>null</b>
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public Object findValue(String propertyName) {
|
||||||
|
if (name.equals(propertyName)) {
|
||||||
|
return value;
|
||||||
|
} else {
|
||||||
|
if (type == IDP_GROUP) {
|
||||||
|
List<Properties> props = (List<Properties>) value;
|
||||||
|
for (Properties p : props) {
|
||||||
|
Object v = p.findValue(propertyName);
|
||||||
|
if (v != null) {
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user