@Override public AttributeType getAttributeType(String attributeName) { if (KEY_ATTRIBUTE_NAME.equals(attributeName)) { return ReflectionHelper.getAttributeType(getKey().getClass()); } else if (THIS_ATTRIBUTE_NAME.equals(attributeName)) { return ReflectionHelper.getAttributeType(getValue().getClass()); } boolean isKey = isKey(attributeName); attributeName = getAttributeName(isKey, attributeName); Data data = getOptionalTargetData(isKey); if (data != null && data.isPortable()) { PortableContext portableContext = serializationService.getPortableContext(); return PortableExtractor.getAttributeType(portableContext, data, attributeName); } return ReflectionHelper.getAttributeType(isKey ? getKey() : getValue(), attributeName); }
@Override public Comparable getAttribute(String attributeName) throws QueryException { if (KEY_ATTRIBUTE_NAME.equals(attributeName)) { return (Comparable) getKey(); } else if (THIS_ATTRIBUTE_NAME.equals(attributeName)) { return (Comparable) getValue(); } boolean isKey = isKey(attributeName); attributeName = getAttributeName(isKey, attributeName); Data targetData = getOptionalTargetData(isKey); // if the content is available in 'Data' format and it is portable, we can directly // extract the content from the targetData, without needing to deserialize if (targetData != null && targetData.isPortable()) { return extractViaPortable(attributeName, targetData); } return extractViaReflection(attributeName, isKey); }