
hudson.util.Digester2 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hudson-core Show documentation
Show all versions of hudson-core Show documentation
Contains the core Hudson code and view files to render HTML.
The newest version!
/*******************************************************************************
*
* Copyright (c) 2004-2009 Oracle Corporation.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*
* Kohsuke Kawaguchi
*
*
*******************************************************************************/
package hudson.util;
import hudson.RestrictedSince;
import org.apache.commons.digester.Digester;
import org.apache.commons.digester.Rule;
import org.xml.sax.Attributes;
/**
* {@link Digester} wrapper to fix the issue DIGESTER-118.
*
* @author Kohsuke Kawaguchi
* @since 1.125
* @deprecated use {@link org.apache.commons.digester3.Digester} instead
* @since 2.1.2
*/
@Deprecated
@RestrictedSince("2.1.2")
public class Digester2 extends Digester {
@Override
public void addObjectCreate(String pattern, Class clazz) {
addRule(pattern,new ObjectCreateRule2(clazz));
}
private static final class ObjectCreateRule2 extends Rule {
private final Class clazz;
public ObjectCreateRule2(Class clazz) {
this.clazz = clazz;
}
@Override
public void begin(String namespace, String name, Attributes attributes) throws Exception {
Object instance = clazz.newInstance();
digester.push(instance);
}
@Override
public void end(String namespace, String name) throws Exception {
digester.pop();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy