This is a confusing question to word. Let's say I have a class, Fruit, which has fields Color, Name, etc. (simplified example) If I have a Color (let's say it's a whole class not a primitive) is there a term for the Color's association to Fruit as the "color" field? The application for this use is more of a Java wrapper around a JSON object. Given an instance of a property within a JSON hierarchy I want to add a custom metadata field that contains the name of the field within its parent that it resides within. e.g. I want the Color class to have a field that is populated with the name of the field name it is within in the containing Fruit class.
Is there a term for this association? The child's parent's field name that represents this child? I'm trying to name a variable and "parentFieldNameForThisChild" is stupid and long and I feel like there must be a formal name for this.
To clarify, the parent object is not what I am after. If the Fruit class looks like this:
class Fruit {
Color fruitColor;
String fruitName;
}
If I am a Color object I want to know that I am contained within the "fruitColor" property of my parent, the Fruit class. This is the association I am looking for a term for. Again, this is a simplified example, and will be applied to a JSON wrapper where the property name is not known explicitly in the code and must be retrieved from the JSON structure.