Package net.jangaroo.exml.model

Source Code of net.jangaroo.exml.model.Declaration

package net.jangaroo.exml.model;


import net.jangaroo.exml.json.JsonObject;
import net.jangaroo.exml.parser.ExmlToModelParser;
import net.jangaroo.utils.AS3Type;
import net.jangaroo.utils.CompilerUtils;

public class Declaration extends TypedField {
  private String value;

  public Declaration(String name, String value, String type) {
    super(name, type == null || type.length() == 0 ? guessType(value) : type);
    this.value = value;
  }

  private static String guessType(String value) {
    AS3Type as3Type = CompilerUtils.guessType(value);
    return as3Type == null ? AS3Type.STRING.toString() : as3Type.toString();
  }

  public String getValue() {
    return JsonObject.valueToString(ExmlToModelParser.getAttributeValue(value, getType()), 4, 2);
  }

}
TOP

Related Classes of net.jangaroo.exml.model.Declaration

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.