@Test public void keyMatchNegativeOneNotAnnotated() throws ODataException { NotAnnotatedBean firstInstance = new NotAnnotatedBean(); SimpleEntity secondInstance = new SimpleEntity(42l, "A Name"); boolean result = annotationHelper.keyMatch(firstInstance, secondInstance); Assert.assertFalse(result); boolean result2 = annotationHelper.keyMatch(secondInstance, firstInstance); Assert.assertFalse(result2); }
public boolean keyMatch(final Object firstInstance, final Object secondInstance) { if (firstInstance == null || secondInstance == null) { return false; } else if (firstInstance.getClass() != secondInstance.getClass()) { return false; } Map<String, Object> firstKeyFields = getValueForAnnotatedFields(firstInstance, EdmKey.class); Map<String, Object> secondKeyFields = getValueForAnnotatedFields(secondInstance, EdmKey.class); if (firstKeyFields.isEmpty() && secondKeyFields.isEmpty()) { throw new AnnotationRuntimeException("Both object instances does not have EdmKey fields defined [" + "firstClass=" + firstInstance.getClass().getName() + " secondClass=" + secondInstance.getClass().getName() + "]."); } return keyValuesMatch(firstKeyFields, secondKeyFields); }
AnnotationHelper { public boolean keyMatch(final Object firstInstance, final Object secondInstance) { if (firstInstance == null || secondInstance == null) { return false; } else if (firstInstance.getClass() != secondInstance.getClass()) { return false; } Map<String, Object> firstKeyFields = getValueForAnnotatedFields(firstInstance, EdmKey.class); Map<String, Object> secondKeyFields = getValueForAnnotatedFields(secondInstance, EdmKey.class); if (firstKeyFields.isEmpty() && secondKeyFields.isEmpty()) { throw new AnnotationRuntimeException("Both object instances does not have EdmKey fields defined [" + "firstClass=" + firstInstance.getClass().getName() + " secondClass=" + secondInstance.getClass().getName() + "]."); } return keyValuesMatch(firstKeyFields, secondKeyFields); } }
AnnotationHelper { public boolean keyMatch(final Object firstInstance, final Object secondInstance) { if (firstInstance == null || secondInstance == null) { return false; } else if (firstInstance.getClass() != secondInstance.getClass()) { return false; } Map<String, Object> firstKeyFields = getValueForAnnotatedFields(firstInstance, EdmKey.class); Map<String, Object> secondKeyFields = getValueForAnnotatedFields(secondInstance, EdmKey.class); if (firstKeyFields.isEmpty() && secondKeyFields.isEmpty()) { throw new AnnotationRuntimeException("Both object instances does not have EdmKey fields defined [" + "firstClass=" + firstInstance.getClass().getName() + " secondClass=" + secondInstance.getClass().getName() + "]."); } return keyValuesMatch(firstKeyFields, secondKeyFields); }  }
AnnotationHelper { public boolean keyMatch(final Object firstInstance, final Object secondInstance) { if (firstInstance == null || secondInstance == null) { return false; } else if (firstInstance.getClass() != secondInstance.getClass()) { return false; } Map<String, Object> firstKeyFields = getValueForAnnotatedFields(firstInstance, EdmKey.class); Map<String, Object> secondKeyFields = getValueForAnnotatedFields(secondInstance, EdmKey.class); if (firstKeyFields.isEmpty() && secondKeyFields.isEmpty()) { throw new AnnotationRuntimeException("Both object instances does not have EdmKey fields defined [" + "firstClass=" + firstInstance.getClass().getName() + " secondClass=" + secondInstance.getClass().getName() + "]."); } return keyValuesMatch(firstKeyFields, secondKeyFields); }  boolean keyMatch(final Object firstInstance, final Object secondInstance); boolean keyMatch(final Object instance, final Map<String, Object> keyName2Value); String extractEntityTypeName(final EdmNavigationProperty enp, final Class<?> fallbackClass); String extractEntityTypeName(final EdmNavigationProperty enp, final Field field); String extractEntityTypeName(final Class<?> annotatedClass); String extractEntitySetName(final Class<?> annotatedClass); FullQualifiedName extractEntityTypeFqn(final EdmEntityType type, final Class<?> annotatedClass); FullQualifiedName extractEntityTypeFqn(final Class<?> annotatedClass); FullQualifiedName extractComplexTypeFqn(final Class<?> annotatedClass); FullQualifiedName extractComplexTypeFqn(final EdmComplexType type, final Class<?> annotatedClass); String extractComplexTypeName(final Class<?> annotatedClass); String generateNamespace(final Class<?> annotatedClass); String getPropertyNameFromAnnotation(final Field field); String getPropertyName(final Field field); String extractToRoleName(final EdmNavigationProperty enp, final Field field); String extractFromRoleEntityName(final Field field); String extractToRoleEntityName(final EdmNavigationProperty enp, final Field field); String getCanonicalRoleName(String name); String extractRelationshipName(final EdmNavigationProperty enp, final Field field); String createCanonicalRelationshipName(String fromRole, String toRole); EdmMultiplicity extractMultiplicity(final EdmNavigationProperty enp, final Field field); T setKeyFields(final T instance, final Map<String, Object> keys); AnnotatedNavInfo getCommonNavigationInfo(final Class<?> sourceClass, final Class<?> targetClass); Class<?> getFieldTypeForProperty(final Class<?> clazz, final String propertyName); Class<?> getFieldTypeForProperty(final Object instance, final String propertyName); Object getValueForProperty(final Object instance, final String propertyName); void setValueForProperty(final Object instance, final String propertyName, final Object propertyValue); Object getValueForField(final Object instance, final String fieldName,
      final Class<? extends Annotation> annotation); Object getValueForField(final Object instance, final Class<? extends Annotation> annotation); Map<String, Object> getValueForAnnotatedFields(final Object instance,
      final Class<? extends Annotation> annotation); void setValueForAnnotatedField(final Object instance, final Class<? extends Annotation> annotation,
      final Object value); void setValuesToAnnotatedFields(final Object instance,
      final Class<? extends Annotation> annotation, final Map<String, Object> fieldName2Value); List<Field> getAnnotatedFields(final Object instance, final Class<? extends Annotation> annotation); List<Field> getAnnotatedFields(final Class<?> fieldClass, final Class<? extends Annotation> annotation); boolean isEdmAnnotated(final Object object); boolean isEdmTypeAnnotated(final Class<?> clazz); boolean isEdmAnnotated(final Class<?> clazz); String getCanonicalName(final Field field); String getCanonicalName(final Class<?> clazz); EdmSimpleTypeKind mapTypeKind(final org.apache.olingo.odata2.api.annotation.edm.EdmType type); EdmMultiplicity mapMultiplicity(final Multiplicity multiplicity); String getCanonicalNamespace(final Class<?> aClass); String extractContainerName(final Class<?> aClass); }
AnnotationHelper { public boolean keyMatch(final Object firstInstance, final Object secondInstance) { if (firstInstance == null || secondInstance == null) { return false; } else if (firstInstance.getClass() != secondInstance.getClass()) { return false; } Map<String, Object> firstKeyFields = getValueForAnnotatedFields(firstInstance, EdmKey.class); Map<String, Object> secondKeyFields = getValueForAnnotatedFields(secondInstance, EdmKey.class); if (firstKeyFields.isEmpty() && secondKeyFields.isEmpty()) { throw new AnnotationRuntimeException("Both object instances does not have EdmKey fields defined [" + "firstClass=" + firstInstance.getClass().getName() + " secondClass=" + secondInstance.getClass().getName() + "]."); } return keyValuesMatch(firstKeyFields, secondKeyFields); }  boolean keyMatch(final Object firstInstance, final Object secondInstance); boolean keyMatch(final Object instance, final Map<String, Object> keyName2Value); String extractEntityTypeName(final EdmNavigationProperty enp, final Class<?> fallbackClass); String extractEntityTypeName(final EdmNavigationProperty enp, final Field field); String extractEntityTypeName(final Class<?> annotatedClass); String extractEntitySetName(final Class<?> annotatedClass); FullQualifiedName extractEntityTypeFqn(final EdmEntityType type, final Class<?> annotatedClass); FullQualifiedName extractEntityTypeFqn(final Class<?> annotatedClass); FullQualifiedName extractComplexTypeFqn(final Class<?> annotatedClass); FullQualifiedName extractComplexTypeFqn(final EdmComplexType type, final Class<?> annotatedClass); String extractComplexTypeName(final Class<?> annotatedClass); String generateNamespace(final Class<?> annotatedClass); String getPropertyNameFromAnnotation(final Field field); String getPropertyName(final Field field); String extractToRoleName(final EdmNavigationProperty enp, final Field field); String extractFromRoleEntityName(final Field field); String extractToRoleEntityName(final EdmNavigationProperty enp, final Field field); String getCanonicalRoleName(String name); String extractRelationshipName(final EdmNavigationProperty enp, final Field field); String createCanonicalRelationshipName(String fromRole, String toRole); EdmMultiplicity extractMultiplicity(final EdmNavigationProperty enp, final Field field); T setKeyFields(final T instance, final Map<String, Object> keys); AnnotatedNavInfo getCommonNavigationInfo(final Class<?> sourceClass, final Class<?> targetClass); Class<?> getFieldTypeForProperty(final Class<?> clazz, final String propertyName); Class<?> getFieldTypeForProperty(final Object instance, final String propertyName); Object getValueForProperty(final Object instance, final String propertyName); void setValueForProperty(final Object instance, final String propertyName, final Object propertyValue); Object getValueForField(final Object instance, final String fieldName,
      final Class<? extends Annotation> annotation); Object getValueForField(final Object instance, final Class<? extends Annotation> annotation); Map<String, Object> getValueForAnnotatedFields(final Object instance,
      final Class<? extends Annotation> annotation); void setValueForAnnotatedField(final Object instance, final Class<? extends Annotation> annotation,
      final Object value); void setValuesToAnnotatedFields(final Object instance,
      final Class<? extends Annotation> annotation, final Map<String, Object> fieldName2Value); List<Field> getAnnotatedFields(final Object instance, final Class<? extends Annotation> annotation); List<Field> getAnnotatedFields(final Class<?> fieldClass, final Class<? extends Annotation> annotation); boolean isEdmAnnotated(final Object object); boolean isEdmTypeAnnotated(final Class<?> clazz); boolean isEdmAnnotated(final Class<?> clazz); String getCanonicalName(final Field field); String getCanonicalName(final Class<?> clazz); EdmSimpleTypeKind mapTypeKind(final org.apache.olingo.odata2.api.annotation.edm.EdmType type); EdmMultiplicity mapMultiplicity(final Multiplicity multiplicity); String getCanonicalNamespace(final Class<?> aClass); String extractContainerName(final Class<?> aClass); static final String DEFAULT_CONTAINER_NAME; }