Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: fixed typo

...

Given are the two unrelated classes Person and DetailedPerson.

 

mapEqualNames() 
anInputPerson {
age: 45,
name: "Jane",
surname: "Doe",
city: "Los Angeles",
country: "USA",
street: "22, Main Road",
zip: 90077
}
The object anInputPerson is of type DetailedPerson.
Code Block
languagenone
set anOutputPerson = mapEqualNames(anInputPerson);

This statement assigns values to the matching attributes of object anOutputPerson which is of type Person:

anOutputPerson {
      name: "Jane",
      surname: "Doe",
      city: "Los Angeles",
      street: "22, Main Road",
      zip: 90077
}
mapEqualNamesIfExists() 
aPerson {
name: "John Ethan George",
surname: "Smith",
city: "New York",
street: "65, Upper Eastside",
zip: 0
}
The object aPerson of type Person already contains values.
In our example, the zip code is unknown, so the attribute zip contains the value 0.
anotherInputPerson {
age: 32,
name: "John",
surname: "Smith",
city: "New York",
country: "USA",
street: NULL,
zip: 12345
}

The object anotherInputPerson is of type DetailedPerson.
In this example object, the attribute name street is missing.

Code Block
languagenone
set aPerson = mapEqualNamesIfExists(anotherInputPerson);

This statement assigns values to the matching attributes of object aPerson:

aPerson {
      name: "John",
      surname: "Smith",
      city: "New York",
      street: "65, Upper Eastside",
      zip: 12345
}
The value of street remains unchanged, because in the source object it did not exist (was NULL).

...