public Object getValue(int nOrdinal)
{
assert !isLazy();
Object value = getValueDirect(nOrdinal);
Attribute attribute = m_metaclass.getInstanceAttribute(nOrdinal);
if (!(value instanceof Undefined) && attribute.isCached() &&
(!attribute.isCalculated() || attribute.isPersistent() ||
m_context.getGeneration() == InvocationContext.GEN_NEW || m_nState >= NEW))
{
return value;
}
++m_nLoadingDepth;
try
{
if (m_nLoadingDepth > MAX_LOADING_DEPTH)
{
throw new IterationCountException("err.persistence.circularLoading",
new Object[]{attribute.getName(), m_metaclass.getName()});
}
if (m_nState == NEW && value == Undefined.VALUE && attribute.getInitializer() != Undefined.VALUE)
{
return setCalcValue(attribute,
m_context.getMachine().invoke(attribute.getInitializerFunction(), new Pair(this)));
}
if (attribute.getValueFunction() != null)
{
return setCalcValue(attribute,
m_context.getMachine().invoke(attribute.getValueFunction(), new Pair(this)));
}
if (attribute.isCollection() && attribute.isPersistent() &&
(m_nState == CLEAN || m_nState == DIRTY))
{
InstanceList list = new InstanceArrayList(0);
setValueDirect(nOrdinal, list);
list.setAssociation(this, attribute, true);
return list;
}
load(attribute.getSymbol());
return getValueDirect(nOrdinal);
}
finally
{