Spring第三个点滴记录java和Csharp中的属性赋值

2014-11-24 08:09:53 · 作者: · 浏览: 0
public class PropertyDemo{
public System.Collections.ArrayList PropertyList { get; set; }
public System.Collections.Specialized.HybridDictionary PropertyDictionary { get; set; }
public System.Collections.Specialized.Nameva lueCollection PropertyNameva lue { get; set; }
public Spring.Collections.Set PropertySet { get; set; }
public System.Collections.Generic.List PropertyStrList { get; set; }
public System.Collections.Generic.Dictionary PropertyStrDictionary { get; set; }
public string this[int index] {
get { return (string)PropertyList[index]; }
set { PropertyList[index] = value; }
}
public string this[string keyName] {
get { return (string)PropertyDictionary[keyName]; }
set { PropertyDictionary.Add(keyName, value); }
}
public DateTime PropertyTime { get; set; }
}
a list element followed by a reference
just some string
a
b
c
jerry
Month
Nikola Tesla
DateTime.Today
上面的标签和csharp的类型需要对应或者用基类也可以, expression是表达式运行的时候会自动换行为响应的值,key-type设置是泛型属性key的类型, key-value设置是泛型属性值的类型,属性索引老版本可能不是这样的设置的
java篇(环境为Maven+Jdk1.7+IntelliJ IDEA 12.1.4)
package springdemo;
import java.util.ArrayList;
import java.util.Map;
import java.util.Set;
public class PropertyDemo {
private ArrayList propertyList;
public ArrayList getPropertyList() {
return propertyList;
}
public void setPropertyList(ArrayList propertyList) {
this.propertyList = propertyList;
}
private Map propertyDictionary;
public Map getPropertyDictionary() {
return propertyDictionary;
}
public void setPropertyDictionary(Map propertyDictionary) {
this.propertyDictionary = propertyDictionary;
}
private Set propertySet;
public Set getPropertySet() {
return propertySet;
}
public void setPropertySet(Set propertySet) {
this.propertySet = propertySet;
}
private Properties propertyprops;
public Properties getPropertyprops() {
return propertyprops;
}
public void setPropertyprops(Properties propertyprops) {
this.propertyprops = propertyprops;
}
}
a list element followed by a reference
just some string
172.0.0.1
myself
不知道java东西少还是什么只有这些,因为java是伪泛型也不支持属性索引器, 因为没有文档都是参考 c# 探索出java的
java和Csharp的共同点
其中我们在标签里面还可以用ref | idref标签或者属性来通过id | name引用其他的对象, 许多标签的属性可以当作一个独立的标签,如下