/** * PUBLIC: * This is a helper method to get the object class from the key converter * if it is a TypeConversionConverter. * This returns null if not using a TypeConversionConverter key converter. */ public Class getKeyClass() { if (!(getKeyConverter() instanceof TypeConversionConverter)) { return null; } return ((TypeConversionConverter)getKeyConverter()).getObjectClass(); }
/** * INTERNAL: * Clone the key, if necessary. * DirectCollections hold on to objects that do not have Descriptors * (e.g. int, String). These objects do not need to be cloned, unless they use a converter - they * are immutable. */ protected Object buildKeyClone(Object element, UnitOfWorkImpl unitOfWork, boolean isExisting) { Object cloneValue = element; if ((getKeyConverter() != null) && getKeyConverter().isMutable()) { cloneValue = getKeyConverter().convertDataValueToObjectValue(getKeyConverter().convertObjectValueToDataValue(cloneValue, unitOfWork), unitOfWork); } return cloneValue; }
/** * INTERNAL: * Initialize and validate the mapping properties. */ public void initialize(AbstractSession session) throws DescriptorException { super.initialize(session); initializeDirectKeyField(session); initializeContainerPolicy(session); if (getKeyConverter() != null) { getKeyConverter().initialize(this, session); } if (getValueConverter() != null) { getValueConverter().initialize(this, session); } }
Object key = iterator.next(); AbstractRecord thisRow = (AbstractRecord)writeQuery.getTranslationRow().clone(); if (getKeyConverter() != null){ key = getKeyConverter().convertObjectValueToDataValue(key, writeQuery.getSession()); AbstractRecord thisRow = (AbstractRecord)writeQuery.getTranslationRow().clone(); Object value = changeRecord.getAddObjects().get(key); if (getKeyConverter() != null){ key = getKeyConverter().convertObjectValueToDataValue(key, writeQuery.getSession());
if (getKeyConverter() != null) { referenceKey = getKeyConverter().convertDataValueToObjectValue(referenceKey, query.getSession());
/** * set the key and value fields that are used to build the container from database rows */ protected void initializeContainerPolicy(AbstractSession session) { ((DirectMapContainerPolicy)getContainerPolicy()).setKeyField(getDirectKeyField()); ((DirectMapContainerPolicy)getContainerPolicy()).setValueField(getDirectField()); ((DirectMapContainerPolicy)getContainerPolicy()).setKeyConverter(getKeyConverter()); ((DirectMapContainerPolicy)getContainerPolicy()).setValueConverter(getValueConverter()); }
Object key = containerPolicy.next(keyIter, query.getSession()); Object value = containerPolicy.valueFromKey(key, objects); if (getKeyConverter() != null) { key = getKeyConverter().convertObjectValueToDataValue(key, query.getSession());