com.alee.managers.style.data
Class SkinInfoConverter

java.lang.Object
  extended by com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
      extended by com.thoughtworks.xstream.converters.reflection.ReflectionConverter
          extended by com.alee.managers.style.data.SkinInfoConverter
All Implemented Interfaces:
com.thoughtworks.xstream.converters.Converter, com.thoughtworks.xstream.converters.ConverterMatcher, com.thoughtworks.xstream.core.Caching

public class SkinInfoConverter
extends com.thoughtworks.xstream.converters.reflection.ReflectionConverter

Custom XStream converter for SkinInfo class.

Author:
Mikle Garin
See Also:
How to use StyleManager, StyleManager, SkinInfo

Nested Class Summary
 
Nested classes/interfaces inherited from class com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.DuplicateFieldException, com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.UnknownFieldException
 
Field Summary
static java.lang.String AUTHOR_NODE
           
static java.lang.String CLASS_NODE
           
static java.lang.String DESCRIPTION_NODE
           
static java.lang.String ID_NODE
          Converter constants.
static java.lang.String INCLUDE_NODE
           
static java.lang.String NAME_NODE
           
static java.lang.String NEAR_CLASS_ATTRIBUTE
           
static java.lang.String STYLE_NODE
           
static java.lang.String SUPPORTED_SYSTEMS_NODE
           
 
Fields inherited from class com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
mapper, reflectionProvider, serializationMethodInvoker
 
Constructor Summary
SkinInfoConverter(com.thoughtworks.xstream.mapper.Mapper mapper, com.thoughtworks.xstream.converters.reflection.ReflectionProvider reflectionProvider)
          Constructs SkinInfoConverter with the specified mapper and reflection provider.
 
Method Summary
static void addCustomResource(java.lang.String nearClass, java.lang.String src, java.lang.String xml)
          Adds custom resource that will be used to change the default resources load strategy.
 boolean canConvert(java.lang.Class type)
          
protected  SkinInfo loadSkinInfo(ResourceFile resourceFile)
          Loads SkinInfo from the specified resource file.
 java.lang.Object unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext context)
          
 
Methods inherited from class com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
canAccess, doMarshal, doUnmarshal, flushCache, instantiateNewInstance, marshal, marshallField, shouldUnmarshalField, shouldUnmarshalTransientFields, unmarshallField
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID_NODE

public static final java.lang.String ID_NODE
Converter constants.

See Also:
Constant Field Values

NAME_NODE

public static final java.lang.String NAME_NODE
See Also:
Constant Field Values

DESCRIPTION_NODE

public static final java.lang.String DESCRIPTION_NODE
See Also:
Constant Field Values

AUTHOR_NODE

public static final java.lang.String AUTHOR_NODE
See Also:
Constant Field Values

SUPPORTED_SYSTEMS_NODE

public static final java.lang.String SUPPORTED_SYSTEMS_NODE
See Also:
Constant Field Values

CLASS_NODE

public static final java.lang.String CLASS_NODE
See Also:
Constant Field Values

INCLUDE_NODE

public static final java.lang.String INCLUDE_NODE
See Also:
Constant Field Values

STYLE_NODE

public static final java.lang.String STYLE_NODE
See Also:
Constant Field Values

NEAR_CLASS_ATTRIBUTE

public static final java.lang.String NEAR_CLASS_ATTRIBUTE
See Also:
Constant Field Values
Constructor Detail

SkinInfoConverter

public SkinInfoConverter(com.thoughtworks.xstream.mapper.Mapper mapper,
                         com.thoughtworks.xstream.converters.reflection.ReflectionProvider reflectionProvider)
Constructs SkinInfoConverter with the specified mapper and reflection provider.

Parameters:
mapper - mapper
reflectionProvider - reflection provider
Method Detail

canConvert

public boolean canConvert(java.lang.Class type)

Specified by:
canConvert in interface com.thoughtworks.xstream.converters.ConverterMatcher
Overrides:
canConvert in class com.thoughtworks.xstream.converters.reflection.ReflectionConverter

unmarshal

public java.lang.Object unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader,
                                  com.thoughtworks.xstream.converters.UnmarshallingContext context)

Specified by:
unmarshal in interface com.thoughtworks.xstream.converters.Converter
Overrides:
unmarshal in class com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter

loadSkinInfo

protected SkinInfo loadSkinInfo(ResourceFile resourceFile)
Loads SkinInfo from the specified resource file. It will use an XML from a predefined resources map if it exists there.

Parameters:
resourceFile - XML resource file
Returns:
loaded SkinInfo

addCustomResource

public static void addCustomResource(java.lang.String nearClass,
                                     java.lang.String src,
                                     java.lang.String xml)
Adds custom resource that will be used to change the default resources load strategy. To put it simple - XML will be taken from this map instead of being read from the file.

Parameters:
nearClass - class near which real XML is located
src - real XML location
xml - XML to use instead the real one