Package pt.webdetails.cdf.dd.model.meta.writer.cdexml

Source Code of pt.webdetails.cdf.dd.model.meta.writer.cdexml.XmlThingWriterFactory

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

package pt.webdetails.cdf.dd.model.meta.writer.cdexml;

import pt.webdetails.cdf.dd.model.core.KnownThingKind;
import pt.webdetails.cdf.dd.model.core.Thing;
import pt.webdetails.cdf.dd.model.core.UnsupportedThingException;
import pt.webdetails.cdf.dd.model.core.writer.IThingWriter;
import pt.webdetails.cdf.dd.model.core.writer.IThingWriterFactory;

/**
* @author dcleao
*/
public class XmlThingWriterFactory implements IThingWriterFactory
{
  public IThingWriter getWriter(Thing t) throws UnsupportedThingException
  {
    if(t == null) { throw new IllegalArgumentException("t"); }

    String kind = t.getKind();

    if(KnownThingKind.ComponentType.equals(kind))
    {
      return new XmlComponentTypeWriter();
    }
    else if(KnownThingKind.PropertyType.equals(kind))
    {
      return new XmlPropertyTypeWriter();
    }
//    else if(KnownThingKind.MetaModel.equals(kind))
//    {
//      return new JsModelWriter();
//    }

    throw new UnsupportedThingException(kind, t.getId());
  }
}
TOP

Related Classes of pt.webdetails.cdf.dd.model.meta.writer.cdexml.XmlThingWriterFactory

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.