FileDocCategorySizeDatePackage
Walk.javaAPI Docmp4parser 1.0-RC-173194Wed Dec 19 20:10:22 GMT 2012com.coremedia.drm.packager.isoparser

Walk

public final class Walk extends Object
Walks through a ContainerBox and its children to see that no getter throws any exception.

Fields Summary
private static final Collection
skipList
Constructors Summary
private Walk()


      
    
Methods Summary
public static voidthrough(com.coremedia.iso.boxes.ContainerBox container)

        for (Box b : container.getBoxes()) {
            List<Box> myBoxes = (List<Box>) container.getBoxes(b.getClass());
            boolean found = false;
            for (Box myBox : myBoxes) {
                if (myBox == b) {
                    found = true;
                }
            }
            if (!found) {
                throw new RuntimeException("Didn't find the box");
            }

            if (b instanceof ContainerBox) {
                Walk.through((ContainerBox) b);
            }


            b.toString(); // Just test if some execption is trown

            BeanInfo beanInfo = Introspector.getBeanInfo(b.getClass());
            PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();

            for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
                String name = propertyDescriptor.getName();
                if (!Walk.skipList.contains(name) &&
                        propertyDescriptor.getReadMethod() != null &&
                        !Box.class.isAssignableFrom(propertyDescriptor.getReadMethod().getReturnType())) {
                    propertyDescriptor.getReadMethod().invoke(b, (Object[]) null);
                }

            }
            if (b instanceof AbstractBox) {
                assert ((AbstractBox) b).isParsed();
            }

        }