org.jenkinsci.jruby
Class AbstractRubyPrimitiveValueConverter<T extends org.jruby.runtime.builtin.IRubyObject>

java.lang.Object
  extended by org.jenkinsci.jruby.AbstractRubyPrimitiveValueConverter<T>
All Implemented Interfaces:
com.thoughtworks.xstream.converters.Converter, com.thoughtworks.xstream.converters.ConverterMatcher
Direct Known Subclasses:
RubyBooleanConverter, RubyFixnumConverter, RubyIntegerConverter, RubyStringConverter, RubySymbolConverter

public abstract class AbstractRubyPrimitiveValueConverter<T extends org.jruby.runtime.builtin.IRubyObject>
extends Object
implements com.thoughtworks.xstream.converters.Converter

Author:
Kohsuke Kawaguchi

Field Summary
protected  org.jruby.Ruby runtime
           
protected  Class<T> type
           
 
Constructor Summary
protected AbstractRubyPrimitiveValueConverter(org.jruby.Ruby runtime, Class<T> type)
           
 
Method Summary
 boolean canConvert(Class type)
           
protected abstract  T fromString(String value)
           
 void marshal(Object source, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, com.thoughtworks.xstream.converters.MarshallingContext context)
           
protected abstract  String toString(T obj)
           
 T unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

runtime

protected final org.jruby.Ruby runtime

type

protected final Class<T extends org.jruby.runtime.builtin.IRubyObject> type
Constructor Detail

AbstractRubyPrimitiveValueConverter

protected AbstractRubyPrimitiveValueConverter(org.jruby.Ruby runtime,
                                              Class<T> type)
Method Detail

fromString

protected abstract T fromString(String value)

toString

protected abstract String toString(T obj)

canConvert

public boolean canConvert(Class type)
Specified by:
canConvert in interface com.thoughtworks.xstream.converters.ConverterMatcher

marshal

public void marshal(Object source,
                    com.thoughtworks.xstream.io.HierarchicalStreamWriter writer,
                    com.thoughtworks.xstream.converters.MarshallingContext context)
Specified by:
marshal in interface com.thoughtworks.xstream.converters.Converter

unmarshal

public T unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader,
                   com.thoughtworks.xstream.converters.UnmarshallingContext context)
Specified by:
unmarshal in interface com.thoughtworks.xstream.converters.Converter


Copyright © 2004-2011. All Rights Reserved.