public OType[] getKeyTypes() { return delegate.getKeyTypes(); }
protected Object convertValue(final OIndex<?> idx, Object iValue) { if (iValue != null) { final OType[] types = idx.getKeyTypes(); if (types.length == 0) iValue = iValue.toString(); else iValue = OType.convert(iValue, types[0].getDefaultJavaType()); } return iValue; }
protected Object convertKey(final OIndex<?> idx, Object iValue) { if (iValue != null) { final OType[] types = idx.getKeyTypes(); if (types.length == 0) iValue = iValue.toString(); else iValue = OType.convert(iValue, types[0].getDefaultJavaType()); } return iValue; }
protected Object[] convertKeys(final OIndex<?> idx, Object[] iValue) { if (iValue != null) { final OType[] types = idx.getKeyTypes(); if (types.length == iValue.length) { Object[] newValue = new Object[types.length]; for (int i = 0; i < types.length; i++) { newValue[i] = OType.convert(iValue[i], types[i].getDefaultJavaType()); } iValue = newValue; } } return iValue; }
protected Object convertKey(final OIndex<?> idx, Object iValue) { if (iValue != null) { final OType[] types = idx.getKeyTypes(); if (types.length == 0) iValue = iValue.toString(); else if (types.length == 1) { iValue = OType.convert(iValue, types[0].getDefaultJavaType()); } else { // if it's a composite key let it through. Otherwise build a composite key for the multivalue if (!(iValue instanceof OCompositeKey) && OMultiValue.isMultiValue(iValue)) { Iterable<Object> values = OMultiValue.getMultiValueIterable(iValue); List<Object> keys = new ArrayList<Object>(); for (Object value : values) { keys.add(value); } if (keys.size() <= types.length) { for (int i = 0; i < types.length; i++) { keys.set(i, OType.convert(keys.get(i), types[i].getDefaultJavaType())); } } else { throw new IllegalArgumentException( "Cannot build a composite key from the input. The size of the parameters is major than the number indexed fields"); } iValue = new OCompositeKey(keys); } } } return iValue; }