2008年12月10日水曜日

JavaFX Object

Object の要素の区切りは、; , \n のどれでもOK

Address {
  street: "1 Main Street";
  city: "Santa Clara";
  state: "CA";
  zip: "95050";
}

Address {
  street: "1 Main Street"
  city: "Santa Clara"
  state: "CA"
  zip: "95050"
}

Address {
  street: "200 Pine Street",
  city: "San Francisco",
  state: "CA",
  zip: "94101",
}

Object を変数に割り当てるには

def addressOne = Address {
  street: "1 Main Street";
  city: "Santa Clara";
  state: "CA";
  zip: "95050";
}

def addressTwo = Address {
  street: "200 Pine Street";
  city: "San Francisco";
  state: "CA";
  zip: "94101";
}

Object を nest するには

def customer = Customer {
  firstName: "John";
  lastName: "Doe";
  phoneNum: "(408) 555-1212";
  address: Address {
    street: "1 Main Street";
    city: "Santa Clara";
    state: "CA";
    zip: "95050";
  }
}

0 件のコメント:

コメントを投稿