com.thoughtworks.xstream.converters.ConverterMatcher Java Examples

The following examples show how to use com.thoughtworks.xstream.converters.ConverterMatcher. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AnnotationReflectionConverter.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Deprecated
public AnnotationReflectionConverter(
                                     Mapper mapper, ReflectionProvider reflectionProvider,
                                     AnnotationProvider annotationProvider) {
    super(mapper, reflectionProvider);
    this.annotationProvider = annotationProvider;
    this.cachedConverters = new HashMap<Class<? extends ConverterMatcher>, Converter>();
}
 
Example #2
Source File: AnnotationReflectionConverter.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
protected void marshallField(final MarshallingContext context, Object newObj, Field field) {
    XStreamConverter annotation = annotationProvider.getAnnotation(
        field, XStreamConverter.class);
    if (annotation != null) {
        Class<? extends ConverterMatcher> type = annotation.value();
        ensureCache(type);
        context.convertAnother(newObj, cachedConverters.get(type));
    } else {
        context.convertAnother(newObj);
    }
}
 
Example #3
Source File: AnnotationReflectionConverter.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
private void ensureCache(Class<? extends ConverterMatcher> type) {
    if (!this.cachedConverters.containsKey(type)) {
        cachedConverters.put(type, newInstance(type));
    }
}
 
Example #4
Source File: XStreamMarshaller.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Set the {@code Converters} or {@code SingleValueConverters} to be registered
 * with the {@code XStream} instance.
 * @see Converter
 * @see SingleValueConverter
 */
public void setConverters(ConverterMatcher... converters) {
	this.converters = converters;
}
 
Example #5
Source File: XStreamMarshaller.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Set the {@code Converters} or {@code SingleValueConverters} to be registered
 * with the {@code XStream} instance.
 * @see Converter
 * @see SingleValueConverter
 */
public void setConverters(ConverterMatcher... converters) {
	this.converters = converters;
}
 
Example #6
Source File: XStreamMarshaller.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Set the {@code Converters} or {@code SingleValueConverters} to be registered
 * with the {@code XStream} instance.
 * @see Converter
 * @see SingleValueConverter
 */
public void setConverters(ConverterMatcher... converters) {
	this.converters = converters;
}