All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.xson.web.ognl.var.VariableVo Maven / Gradle / Ivy

Go to download

xco-web is an easy to use control layer framework, is part of the SOA system, using xml language to describe the controller.

The newest version!
package org.xson.web.ognl.var;

import java.util.List;

import org.xson.web.ognl.Ognl;

/**
 * 变量
 */
public class VariableVo {

	private VariableUnitVo			varUnit				= null;

	private List	varUnitList			= null;

	// 属性的默认值 #{abccc|0, null, 'xxx', now(), date(), time()}, 只有在变量[#{}|${}]里边才可以存在
	private Object					defaultValue		= null;

	// 默认值类型: 0:普通, 1:now(), 2:date(), 3:time()
	private int						defaultValueType	= 0;

	private boolean					hasDefault			= false;

	// 原始的属性字符串, 用作日志显示
	private String					original;

	protected VariableVo(String original, VariableUnitVo varUnit, boolean hasDefault, Object defaultValue, int defaultValueType) {
		this.original = original;
		this.varUnit = varUnit;
		this.hasDefault = hasDefault;
		this.defaultValue = defaultValue;
		this.defaultValueType = defaultValueType;
	}

	protected VariableVo(String original, List varUnitList, boolean hasDefault, Object defaultValue, int defaultValueType) {
		this.original = original;
		this.varUnitList = varUnitList;
		this.hasDefault = hasDefault;
		this.defaultValue = defaultValue;
		this.defaultValueType = defaultValueType;
	}

	public Object getDefaultValue() {
		if (0 == defaultValueType) {
			return defaultValue;
		} else if (1 == defaultValueType) {
			return new java.util.Date();
		} else if (2 == defaultValueType) {
			return new java.sql.Date(new java.util.Date().getTime());
		} else {
			return new java.sql.Time(new java.util.Date().getTime());
		}
	}

	public VariableUnitVo getVarUnit() {
		return varUnit;
	}

	public List getVarUnitList() {
		return varUnitList;
	}

	public boolean isHasDefault() {
		return hasDefault;
	}

	public String getOriginal() {
		return original;
	}

	// public Object getValue(Map data) {
	// // TODO 默认值在这里处理
	// return OgnlMap.getValue(data, this);
	// }

	public Object getValue(Object data) {
		return Ognl.getValue(data, this);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy