Code example for Constructor

Methods: newInstance, setAccessible

0
    /** Calls the private constructor of the parser */ 
    @SuppressWarnings("unused") 
    private AndroidTargetParser _Constructor(String osJarPath) throws Exception {
        Constructor<AndroidTargetParser> constructor =
            AndroidTargetParser.class.getDeclaredConstructor(String.class);
        constructor.setAccessible(true);
        return constructor.newInstance(osJarPath);
    } 
     
    /** calls the private getLayoutClasses() of the parser */ 
    @SuppressWarnings("unused") 
    private void _getLayoutClasses() throws Exception { 
        Method method = AndroidTargetParser.class.getDeclaredMethod("getLayoutClasses");  //$NON-NLS-1$
        method.setAccessible(true);
        method.invoke(mParser);
    } 
     
    /** calls the private addGroup() of the parser */ 
    @SuppressWarnings("unused") 
    private ViewClassInfo _addGroup(Class<?> groupClass) throws Exception {
        Method method = LayoutParamsParser.class.getDeclaredMethod("addGroup",  //$NON-NLS-1$