Sha256: 4cbeda8a04ecd75cbc1d9556c922c5b469db5902b20981ca96d41ecf7480bf57

Contents?: true

Size: 1.78 KB

Versions: 5

Compression:

Stored size: 1.78 KB

Contents

package smile.xml.xpath;

import org.jruby.Ruby;
import org.jruby.RubyClass;
import org.jruby.RubyObject;
import org.jruby.RubyString;
import org.jruby.anno.JRubyClass;
import org.jruby.anno.JRubyMethod;
import org.jruby.runtime.ObjectAllocator;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;

import smile.xml.util.UtilJ;

@JRubyClass( name="LibXML::XML::XPath::Expression" )
public class XPathExpressionJ extends RubyObject {
	
	private static final long serialVersionUID = 9176572911090989553L;
	
	private static final ObjectAllocator ALLOCATOR = new ObjectAllocator() {
		
		public IRubyObject allocate(Ruby runtime, RubyClass klass) {
			return new XPathExpressionJ(runtime, klass);
		}
	};

	public static RubyClass define(Ruby runtime) {
		return UtilJ.defineClass(runtime, XPathExpressionJ.class, ALLOCATOR);
	}

	private static RubyClass getRubyClass(Ruby runtime) {
		return UtilJ.getClass(runtime, XPathExpressionJ.class);
	}

	@JRubyMethod( name="compile", module=true )
	public static XPathExpressionJ compile(ThreadContext context, IRubyObject self, IRubyObject pString ) {
		RubyString string = (RubyString) pString;
		return newInstance(context, string );		
	}
	
	public static XPathExpressionJ newInstance(ThreadContext context, RubyString string ) {
		IRubyObject[] args = { string };
		return (XPathExpressionJ) getRubyClass(context.getRuntime()).newInstance(
				context, args, null);
	}

	private XPathExpressionJ(Ruby runtime, RubyClass metaClass) {
		super(runtime, metaClass);
	}

	private RubyString string;
	
	@JRubyMethod(name = "initialize" )
	public void initialize(ThreadContext context, RubyString pString ) {
		string = pString;
	}
	
	public RubyString getExpression() {
		return string;
	}

}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
smile-xml-1.0.5-java src/main/java/smile/xml/xpath/XPathExpressionJ.java
smile-xml-1.0.4-java src/main/java/smile/xml/xpath/XPathExpressionJ.java
smile-xml-1.0.3-java src/main/java/smile/xml/xpath/XPathExpressionJ.java
smile-xml-1.0.3-jruby src/main/java/smile/xml/xpath/XPathExpressionJ.java
smile-xml-1.0.2-jruby src/main/java/smile/xml/xpath/XPathExpressionJ.java