in stetho/src/main/java/com/facebook/stetho/inspector/elements/android/ViewDescriptor.java [78:122]
private List<ViewCSSProperty> getViewProperties() {
if (mViewProperties == null) {
synchronized (this) {
if (mViewProperties == null) {
List<ViewCSSProperty> props = new ArrayList<>();
for (final Method method : View.class.getDeclaredMethods()) {
ViewDebug.ExportedProperty annotation =
method.getAnnotation(
ViewDebug.ExportedProperty.class);
if (annotation != null) {
props.add(new MethodBackedCSSProperty(
method,
convertViewPropertyNameToCSSName(method.getName()),
annotation));
}
}
for (final Field field : View.class.getDeclaredFields()) {
ViewDebug.ExportedProperty annotation =
field.getAnnotation(
ViewDebug.ExportedProperty.class);
if (annotation != null) {
props.add(new FieldBackedCSSProperty(
field,
convertViewPropertyNameToCSSName(field.getName()),
annotation));
}
}
Collections.sort(props, new Comparator<ViewCSSProperty>() {
@Override
public int compare(ViewCSSProperty lhs, ViewCSSProperty rhs) {
return lhs.getCSSName().compareTo(rhs.getCSSName());
}
});
mViewProperties = Collections.unmodifiableList(props);
}
}
}
return mViewProperties;
}