private TemporalType getTemporalType(XProperty property) { if ( key ) { MapKeyTemporal ann = property.getAnnotation( MapKeyTemporal.class ); return ann.value(); } else { Temporal ann = property.getAnnotation( Temporal.class ); return ann.value(); } }
@Test public void testMapKeyTemporal() throws Exception { reader = getReader( Entity3.class, "field1", "element-collection.orm8.xml" ); assertAnnotationPresent( ElementCollection.class ); assertAnnotationNotPresent( MapKey.class ); assertAnnotationNotPresent( MapKeyClass.class ); assertAnnotationPresent( MapKeyTemporal.class ); assertAnnotationNotPresent( MapKeyEnumerated.class ); assertAnnotationNotPresent( MapKeyColumn.class ); assertAnnotationNotPresent( MapKeyJoinColumns.class ); assertAnnotationNotPresent( MapKeyJoinColumn.class ); assertEquals( TemporalType.DATE, reader.getAnnotation( MapKeyTemporal.class ).value() ); }
@Test public void testMapKeyTemporal() throws Exception { reader = getReader( Entity3.class, "field1", "many-to-many.orm8.xml" ); assertAnnotationPresent( ManyToMany.class ); assertAnnotationNotPresent( MapKey.class ); assertAnnotationNotPresent( MapKeyClass.class ); assertAnnotationPresent( MapKeyTemporal.class ); assertAnnotationNotPresent( MapKeyEnumerated.class ); assertAnnotationNotPresent( MapKeyColumn.class ); assertAnnotationNotPresent( MapKeyJoinColumns.class ); assertAnnotationNotPresent( MapKeyJoinColumn.class ); assertEquals( TemporalType.DATE, reader.getAnnotation( MapKeyTemporal.class ).value() ); }
private TemporalType getTemporalType(XProperty property) { if (key) { MapKeyTemporal ann = property.getAnnotation( MapKeyTemporal.class ); return ann.value(); } else { Temporal ann = property.getAnnotation( Temporal.class ); return ann.value(); } }
/** * Handles the {@link Temporal} annotation. * * @param member * the member * @param parsed * the list of annotations parsed * @return the map key value * * @since 2.0.0 */ private TemporalType handleTemporalType(Member member, Set<Class<? extends Annotation>> parsed) { final MapKeyTemporal annotation = ReflectHelper.getAnnotation(member, MapKeyTemporal.class); if (annotation != null) { parsed.add(MapKeyTemporal.class); return annotation.value(); } return null; }
/** * Handles the {@link MapKeyTemporal} annotation. * * @param member * the member * @param parsed * the list of annotations parsed * @return the map key value * * @since 2.0.0 */ private TemporalType handleMapKeyTemporalType(Member member, Set<Class<? extends Annotation>> parsed) { final MapKeyTemporal annotation = ReflectHelper.getAnnotation(member, MapKeyTemporal.class); if (annotation != null) { parsed.add(MapKeyTemporal.class); return annotation.value(); } return null; }
/** * Handles the {@link MapKeyTemporal} annotation. * * @param member * the member * @param parsed * the list of annotations parsed * @return the map key value * * @since 2.0.0 */ protected TemporalType handleMapKeyTemporalType(Member member, Set<Class<? extends Annotation>> parsed) { final MapKeyTemporal annotation = ReflectHelper.getAnnotation(member, MapKeyTemporal.class); if (annotation != null) { parsed.add(MapKeyTemporal.class); return annotation.value(); } return null; }
/** * Handles the {@link MapKeyTemporal} annotation. * * @param member * the member * @param parsed * the list of annotations parsed * @return the map key value * * @since 2.0.0 */ private TemporalType handleMapKeyTemporalType(Member member, Set<Class<? extends Annotation>> parsed) { final MapKeyTemporal annotation = ReflectHelper.getAnnotation(member, MapKeyTemporal.class); if (annotation != null) { parsed.add(MapKeyTemporal.class); return annotation.value(); } return null; }
/** * Handles the {@link Temporal} annotation. * * @param member * the member * @param parsed * the list of annotations parsed * @return the map key value * * @since 2.0.0 */ private TemporalType handleTemporalType(Member member, Set<Class<? extends Annotation>> parsed) { final MapKeyTemporal annotation = ReflectHelper.getAnnotation(member, MapKeyTemporal.class); if (annotation != null) { parsed.add(MapKeyTemporal.class); return annotation.value(); } return null; }
/** * Handles the {@link MapKeyTemporal} annotation. * * @param member * the member * @param parsed * the list of annotations parsed * @return the map key value * * @since 2.0.0 */ protected TemporalType handleMapKeyTemporalType(Member member, Set<Class<? extends Annotation>> parsed) { final MapKeyTemporal annotation = ReflectHelper.getAnnotation(member, MapKeyTemporal.class); if (annotation != null) { parsed.add(MapKeyTemporal.class); return annotation.value(); } return null; }
/** * Handles the {@link MapKeyTemporal} annotation. * * @param member * the member * @param parsed * the list of annotations parsed * @return the map key value * * @since 2.0.0 */ private TemporalType handleMapKeyTemporalType(Member member, Set<Class<? extends Annotation>> parsed) { final MapKeyTemporal annotation = ReflectHelper.getAnnotation(member, MapKeyTemporal.class); if (annotation != null) { parsed.add(MapKeyTemporal.class); return annotation.value(); } return null; }
/** * Handles the {@link Temporal} annotation. * * @param member * the member * @param parsed * the list of annotations parsed * @return the map key value * * @since 2.0.0 */ private TemporalType handleTemporalType(Member member, Set<Class<? extends Annotation>> parsed) { final MapKeyTemporal annotation = ReflectHelper.getAnnotation(member, MapKeyTemporal.class); if (annotation != null) { parsed.add(MapKeyTemporal.class); return annotation.value(); } return null; }
/** * Handles the {@link MapKeyTemporal} annotation. * * @param member * the member * @param parsed * the list of annotations parsed * @return the map key value * * @since 2.0.0 */ protected TemporalType handleMapKeyTemporalType(Member member, Set<Class<? extends Annotation>> parsed) { final MapKeyTemporal annotation = ReflectHelper.getAnnotation(member, MapKeyTemporal.class); if (annotation != null) { parsed.add(MapKeyTemporal.class); return annotation.value(); } return null; }
private void mapKeySupplementalDetails( XProperty navigableXProperty, MetadataBuildingContext buildingContext) { final MapKeyEnumerated mapKeyEnumeratedAnn = navigableXProperty.getAnnotation( MapKeyEnumerated.class ); if ( mapKeyEnumeratedAnn != null ) { enumType = mapKeyEnumeratedAnn.value(); } final MapKeyTemporal mapKeyTemporalAnn = navigableXProperty.getAnnotation( MapKeyTemporal.class ); if ( mapKeyTemporalAnn != null ) { temporalPrecision = mapKeyTemporalAnn.value(); } } private void normalSupplementalDetails(
private TemporalType getTemporalType(XProperty property) { if ( key ) { MapKeyTemporal ann = property.getAnnotation( MapKeyTemporal.class ); return ann.value(); } else { Temporal ann = property.getAnnotation( Temporal.class ); return ann.value(); } }
private TemporalType getTemporalType(XProperty property) { if ( key ) { MapKeyTemporal ann = property.getAnnotation( MapKeyTemporal.class ); return ann.value(); } else { Temporal ann = property.getAnnotation( Temporal.class ); return ann.value(); } }
/** * Parse @Temporal. */ private void parseMapKeyTemporal(FieldMapping fm, MapKeyTemporal anno) { List<Column> cols = fm.getKeyMapping().getValueInfo().getColumns(); if (!cols.isEmpty() && cols.size() != 1) throw new MetaDataException(_loc.get("num-cols-mismatch", fm, String.valueOf(cols.size()), "1")); if (cols.isEmpty()) { cols = Arrays.asList(new Column[]{ new Column() }); fm.getKeyMapping().getValueInfo().setColumns(cols); } Column col = (Column) cols.get(0); switch (anno.value()) { case DATE: col.setType(Types.DATE); break; case TIME: col.setType(Types.TIME); break; case TIMESTAMP: col.setType(Types.TIMESTAMP); break; } }
/** * Parse @Temporal. */ private void parseMapKeyTemporal(FieldMapping fm, MapKeyTemporal anno) { List<Column> cols = fm.getKeyMapping().getValueInfo().getColumns(); if (!cols.isEmpty() && cols.size() != 1) throw new MetaDataException(_loc.get("num-cols-mismatch", fm, String.valueOf(cols.size()), "1")); if (cols.isEmpty()) { cols = Arrays.asList(new Column[]{ new Column() }); fm.getKeyMapping().getValueInfo().setColumns(cols); } Column col = (Column) cols.get(0); switch (anno.value()) { case DATE: col.setType(Types.DATE); break; case TIME: col.setType(Types.TIME); break; case TIMESTAMP: col.setType(Types.TIMESTAMP); break; } }
/** * Parse @Temporal. */ private void parseMapKeyTemporal(FieldMapping fm, MapKeyTemporal anno) { List<Column> cols = fm.getKeyMapping().getValueInfo().getColumns(); if (!cols.isEmpty() && cols.size() != 1) throw new MetaDataException(_loc.get("num-cols-mismatch", fm, String.valueOf(cols.size()), "1")); if (cols.isEmpty()) { cols = Arrays.asList(new Column[]{ new Column() }); fm.getKeyMapping().getValueInfo().setColumns(cols); } Column col = (Column) cols.get(0); switch (anno.value()) { case DATE: col.setType(Types.DATE); break; case TIME: col.setType(Types.TIME); break; case TIMESTAMP: col.setType(Types.TIMESTAMP); break; } }
temporalPrecision = mapKeyTemporalAnn.value();