Package com.thoughtworks.xstream

Examples of com.thoughtworks.xstream.XStream.registerConverter()


    public static String serialize(final Object object) {
        String result = null;

        XStream xstream = new XStream();
        xstream.registerConverter(new GuardedStringConverter());
        try {
            result = URLEncoder.encode(xstream.toXML(object), SyncopeConstants.DEFAULT_ENCODING);
        } catch (UnsupportedEncodingException e) {
            LOG.error("During serialization", e);
        }
View Full Code Here


    @SuppressWarnings("unchecked")
    public static <T extends Object> T deserialize(final String serialized) {
        T result = null;

        XStream xstream = new XStream();
        xstream.registerConverter(new GuardedStringConverter());
        try {
            result = (T) xstream.fromXML(URLDecoder.decode(serialized, SyncopeConstants.DEFAULT_ENCODING));
        } catch (UnsupportedEncodingException e) {
            LOG.error("During deserialization", e);
        }
View Full Code Here

    @SuppressWarnings("unchecked")
    private void read(InputStream input) {
        m_roles.clear();
        // We use DomDriver because the standard XPP driver has issues with attributes.
        XStream xstream = new XStream(/*new DomDriver()*/);
        xstream.registerConverter(ROLEMAPCONVERTER);
        xstream.registerConverter(ROLECONVERTER);
        xstream.registerConverter(DICTCONVERTER);
        xstream.aliasType("roles", Map.class);
        try {
            Map<String, RoleImpl> fromXML = (Map<String, RoleImpl>) xstream.fromXML(input);
View Full Code Here

    private void read(InputStream input) {
        m_roles.clear();
        // We use DomDriver because the standard XPP driver has issues with attributes.
        XStream xstream = new XStream(/*new DomDriver()*/);
        xstream.registerConverter(ROLEMAPCONVERTER);
        xstream.registerConverter(ROLECONVERTER);
        xstream.registerConverter(DICTCONVERTER);
        xstream.aliasType("roles", Map.class);
        try {
            Map<String, RoleImpl> fromXML = (Map<String, RoleImpl>) xstream.fromXML(input);
            m_roles.putAll(fromXML);
View Full Code Here

        m_roles.clear();
        // We use DomDriver because the standard XPP driver has issues with attributes.
        XStream xstream = new XStream(/*new DomDriver()*/);
        xstream.registerConverter(ROLEMAPCONVERTER);
        xstream.registerConverter(ROLECONVERTER);
        xstream.registerConverter(DICTCONVERTER);
        xstream.aliasType("roles", Map.class);
        try {
            Map<String, RoleImpl> fromXML = (Map<String, RoleImpl>) xstream.fromXML(input);
            m_roles.putAll(fromXML);
        }
View Full Code Here

     * @throws java.io.IOException When there is a problem creating the stream, or
     * the other end of the stream fails.
     */
    private void write(OutputStream out) throws IOException {
        XStream xstream = new XStream(new DomDriver());
        xstream.registerConverter(ROLEMAPCONVERTER);
        xstream.registerConverter(ROLECONVERTER);
        xstream.registerConverter(DICTCONVERTER);
        xstream.aliasType("roles", Map.class);
        xstream.toXML(m_roles, out);
        try {
View Full Code Here

     * the other end of the stream fails.
     */
    private void write(OutputStream out) throws IOException {
        XStream xstream = new XStream(new DomDriver());
        xstream.registerConverter(ROLEMAPCONVERTER);
        xstream.registerConverter(ROLECONVERTER);
        xstream.registerConverter(DICTCONVERTER);
        xstream.aliasType("roles", Map.class);
        xstream.toXML(m_roles, out);
        try {
            out.close();
View Full Code Here

     */
    private void write(OutputStream out) throws IOException {
        XStream xstream = new XStream(new DomDriver());
        xstream.registerConverter(ROLEMAPCONVERTER);
        xstream.registerConverter(ROLECONVERTER);
        xstream.registerConverter(DICTCONVERTER);
        xstream.aliasType("roles", Map.class);
        xstream.toXML(m_roles, out);
        try {
            out.close();
        }
View Full Code Here

        XStream xstream = new XStream(reflectionProvider);

        // AbstractName
        xstream.alias("abstractName", AbstractName.class);
        xstream.addImmutableType(AbstractName.class);
        xstream.registerConverter(new AbstractNameConverter());

        // AbstractNameQuery
        xstream.alias("abstractNameQuery", AbstractNameQuery.class);
        xstream.addImmutableType(AbstractNameQuery.class);
        xstream.registerConverter(new AbstractNameQueryConverter());
View Full Code Here

        xstream.registerConverter(new AbstractNameConverter());

        // AbstractNameQuery
        xstream.alias("abstractNameQuery", AbstractNameQuery.class);
        xstream.addImmutableType(AbstractNameQuery.class);
        xstream.registerConverter(new AbstractNameQueryConverter());

        // Artifact
        xstream.alias("artifact", Artifact.class);
        xstream.addImmutableType(Artifact.class);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.