public boolean apply(Method m) { final AnnotationDelegate annotations = getAnnotationDelegate(converter, m); return !annotations.isAnnotationPresent(Ignore.class) && !annotations.isAnnotationPresent(OneToOne.class) && !annotations.isAnnotationPresent(OneToMany.class) && !annotations.isAnnotationPresent(ManyToMany.class); } });
public boolean apply(Method m) { final AnnotationDelegate annotations = getAnnotationDelegate(converter, m); return !annotations.isAnnotationPresent(Ignore.class) && !annotations.isAnnotationPresent(OneToOne.class) && !annotations.isAnnotationPresent(OneToMany.class) && !annotations.isAnnotationPresent(ManyToMany.class); } });
private static boolean isAutoIncrement(Class<?> type, AnnotationDelegate annotations, TypeInfo<?> dbType) { final boolean isAutoIncrement = annotations.isAnnotationPresent(AutoIncrement.class); if (isAutoIncrement && (!AUTO_INCREMENT_LEGAL_TYPES.contains(dbType.getJdbcWriteType()) || type.isEnum())) { throw new ActiveObjectsConfigurationException(AutoIncrement.class.getName() + " is not supported for type: " + dbType); } return isAutoIncrement; }
private static boolean isAutoIncrement(Class<?> type, AnnotationDelegate annotations, TypeInfo<?> dbType) { final boolean isAutoIncrement = annotations.isAnnotationPresent(AutoIncrement.class); if (isAutoIncrement && (!AUTO_INCREMENT_LEGAL_TYPES.contains(dbType.getJdbcWriteType()) || type.isEnum())) { throw new ActiveObjectsConfigurationException(AutoIncrement.class.getName() + " is not supported for type: " + dbType); } return isAutoIncrement; }
@SuppressWarnings("unchecked") private FieldInfo createFieldInfo(String fieldName, Method accessor, Method mutator) { Class fieldType = Common.getAttributeTypeFromMethod(MoreObjects.firstNonNull(accessor, mutator)); AnnotationDelegate annotations = getAnnotations(accessor, mutator); Generator generatorAnnotation = annotations.getAnnotation(Generator.class); return new ImmutableFieldInfo( fieldName, fieldType.isAnnotationPresent(Polymorphic.class) ? nameConverters.getFieldNameConverter().getPolyTypeName(MoreObjects.firstNonNull(accessor, mutator)) : null, accessor, mutator, fieldType, typeManager.getType(fieldType), annotations.isAnnotationPresent(PrimaryKey.class), !annotations.isAnnotationPresent(NotNull.class), annotations.isAnnotationPresent(Transient.class), annotations.isAnnotationPresent(AutoIncrement.class), annotations.isAnnotationPresent(Default.class), generatorAnnotation != null ? generatorAnnotation.value() : null ); }
@SuppressWarnings("unchecked") private FieldInfo createFieldInfo(String fieldName, Method accessor, Method mutator) { Class fieldType = Common.getAttributeTypeFromMethod(MoreObjects.firstNonNull(accessor, mutator)); AnnotationDelegate annotations = getAnnotations(accessor, mutator); Generator generatorAnnotation = annotations.getAnnotation(Generator.class); return new ImmutableFieldInfo( fieldName, fieldType.isAnnotationPresent(Polymorphic.class) ? nameConverters.getFieldNameConverter().getPolyTypeName(MoreObjects.firstNonNull(accessor, mutator)) : null, accessor, mutator, fieldType, typeManager.getType(fieldType), annotations.isAnnotationPresent(PrimaryKey.class), !annotations.isAnnotationPresent(NotNull.class), annotations.isAnnotationPresent(Transient.class), annotations.isAnnotationPresent(AutoIncrement.class), annotations.isAnnotationPresent(Default.class), generatorAnnotation != null ? generatorAnnotation.value() : null ); }
private static boolean isPrimaryKey(AnnotationDelegate annotations, DDLField field) { final boolean isPrimaryKey = annotations.isAnnotationPresent(PrimaryKey.class); if (isPrimaryKey && !field.getType().isAllowedAsPrimaryKey()) { throw new ActiveObjectsConfigurationException(PrimaryKey.class.getName() + " is not supported for type: " + field.getType()); } return isPrimaryKey; }
private static boolean isPrimaryKey(AnnotationDelegate annotations, DDLField field) { final boolean isPrimaryKey = annotations.isAnnotationPresent(PrimaryKey.class); if (isPrimaryKey && !field.getType().isAllowedAsPrimaryKey()) { throw new ActiveObjectsConfigurationException(PrimaryKey.class.getName() + " is not supported for type: " + field.getType()); } return isPrimaryKey; }
field.setNotNull(annotations.isAnnotationPresent(NotNull.class) || annotations.isAnnotationPresent(Unique.class) || annotations.isAnnotationPresent(PrimaryKey.class)); field.setUnique(annotations.isAnnotationPresent(Unique.class)); if (annotations.isAnnotationPresent(Default.class)) { final Object defaultValue = convertStringDefaultValue(annotations.getAnnotation(Default.class).value(), sqlType, method); if (type.isEnum() && ((Integer) defaultValue) > EnumUtils.size((Class<? extends Enum>) type) - 1) {
field.setNotNull(annotations.isAnnotationPresent(NotNull.class) || annotations.isAnnotationPresent(Unique.class) || annotations.isAnnotationPresent(PrimaryKey.class)); field.setUnique(annotations.isAnnotationPresent(Unique.class)); if (annotations.isAnnotationPresent(Default.class)) { final Object defaultValue = convertStringDefaultValue(annotations.getAnnotation(Default.class).value(), sqlType, method); if (type.isEnum() && ((Integer) defaultValue) > EnumUtils.size((Class<? extends Enum>) type) - 1) {