private static void checkValidComputed(String propertyName, Map<Class<? extends Annotation>, Annotation> annotations) { if (annotations.containsKey(Computed.class)) { Computed computed = (Computed) annotations.get(Computed.class); if (computed.value().isEmpty()) { throw new IllegalArgumentException(String.format("Property '%s': attribute 'value' of annotation @Computed is mandatory for computed properties", propertyName)); } if (annotations.containsKey(Column.class)) { throw new IllegalArgumentException(String.format("Property '%s' cannot be annotated with both @Column and @Computed", propertyName)); } } }
String expression = ((Computed) annotations.get(Computed.class)).value(); if (expression.isEmpty()) throw new IllegalArgumentException(String.format("Property '%s': attribute 'value' of annotation @Computed is mandatory for computed properties", propertyName));