Пример #1
0
  @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);
  }
Пример #2
0
 // This method is very inefficient because:
 // lot of time is spend on retrieving field/method and it isn't cached
 // the actual invocation on the Field, Method is also is quite expensive.
 private Comparable extractViaReflection(String attributeName, boolean isKey) {
   try {
     Object obj = isKey ? getKey() : getValue();
     return ReflectionHelper.extractValue(obj, attributeName);
   } catch (QueryException e) {
     throw e;
   } catch (Exception e) {
     throw new QueryException(e);
   }
 }
Пример #3
0
 public AttributeType getAttributeType(String attributeName) {
   return ReflectionHelper.getAttributeType(attributeValue.getClass());
 }