本文整理了Java中javax.persistence.Temporal.value()
方法的一些代码示例,展示了Temporal.value()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Temporal.value()
方法的具体详情如下:
包路径:javax.persistence.Temporal
类名称:Temporal
方法名:value
暂无
代码示例来源:origin: querydsl/querydsl
@Override
public void inspect(Element element, Annotations annotations) {
Temporal temporal = element.getAnnotation(Temporal.class);
if (temporal != null && element.getAnnotation(ElementCollection.class) == null) {
PropertyType propertyType = null;
switch (temporal.value()) {
case DATE: propertyType = PropertyType.DATE; break;
case TIME: propertyType = PropertyType.TIME; break;
case TIMESTAMP: propertyType = PropertyType.DATETIME;
}
annotations.addAnnotation(new QueryTypeImpl(propertyType));
}
}
代码示例来源:origin: hibernate/hibernate-orm
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();
}
}
代码示例来源:origin: BroadleafCommerce/BroadleafCommerce
field.setAccessible(true);
try {
if (TemporalType.TIMESTAMP.equals(temporalAnnotation.value()) && (field.isAnnotationPresent(AutoPopulate.class))) {
if (field.get(entity) == null || field.getAnnotation(AutoPopulate.class).autoUpdateValue()) {
if (type.isAssignableFrom(Date.class)) {
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testTemporal() throws Exception {
reader = getReader( Entity3.class, "field1", "element-collection.orm18.xml" );
assertAnnotationPresent( ElementCollection.class );
assertAnnotationPresent( Temporal.class );
assertAnnotationNotPresent( Enumerated.class );
assertAnnotationNotPresent( Lob.class );
assertEquals(
TemporalType.DATE, reader.getAnnotation(
Temporal.class
).value()
);
}
代码示例来源:origin: org.hibernate/hibernate-annotations
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();
}
}
代码示例来源:origin: ebean-orm/ebean
private void readTemporal(Temporal temporal, DeployBeanProperty prop) {
TemporalType type = temporal.value();
if (type == TemporalType.DATE) {
prop.setDbType(Types.DATE);
} else if (type == TemporalType.TIMESTAMP) {
prop.setDbType(Types.TIMESTAMP);
} else if (type == TemporalType.TIME) {
prop.setDbType(Types.TIME);
} else {
throw new PersistenceException("Unhandled type " + type);
}
}
代码示例来源:origin: apache/cloudstack
if (temporal.value() == TemporalType.DATE) {
flags = Flag.Date.setTrue(flags);
} else if (temporal.value() == TemporalType.TIME) {
flags = Flag.Time.setTrue(flags);
} else if (temporal.value() == TemporalType.TIMESTAMP) {
flags = Flag.TimeStamp.setTrue(flags);
代码示例来源:origin: hatunet/spring-data-mybatis
@Nullable
TemporalType getTemporalType() {
if (temporalType == null) {
this.temporalType = annotation == null ? null : annotation.value();
}
return this.temporalType;
}
代码示例来源:origin: odata4j/odata4j
protected TemporalType getTemporalType(SingularAttribute<?, ?> sa) {
Member member = sa.getJavaMember();
Temporal temporal = null;
if (member instanceof Field) {
temporal = ((Field) member).getAnnotation(Temporal.class);
} else if (member instanceof Method) {
temporal = ((Method) member).getAnnotation(Temporal.class);
}
return temporal == null ? null : temporal.value();
}
代码示例来源:origin: com.haulmont.cuba/cuba-global
protected Class getTypeOverride(AnnotatedElement element) {
Temporal temporal = element.getAnnotation(Temporal.class);
if (temporal != null && temporal.value().equals(TemporalType.DATE))
return java.sql.Date.class;
else if (temporal != null && temporal.value().equals(TemporalType.TIME))
return java.sql.Time.class;
else
return null;
}
代码示例来源:origin: io.cronapp/olingo-odata2-jpa-processor-core
private static TemporalType determineTemporalType(final Attribute<?, ?> currentAttribute)
throws ODataJPAModelException {
if (currentAttribute != null) {
AnnotatedElement annotatedElement = (AnnotatedElement) currentAttribute.getJavaMember();
if (annotatedElement != null && annotatedElement.getAnnotation(Temporal.class) != null) {
return annotatedElement.getAnnotation(Temporal.class).value();
}
}
return null;
}
}
代码示例来源:origin: org.apache.olingo/olingo-odata2-jpa-processor-core
private static TemporalType determineTemporalType(final Attribute<?, ?> currentAttribute)
throws ODataJPAModelException {
if (currentAttribute != null) {
AnnotatedElement annotatedElement = (AnnotatedElement) currentAttribute.getJavaMember();
if (annotatedElement != null && annotatedElement.getAnnotation(Temporal.class) != null) {
return annotatedElement.getAnnotation(Temporal.class).value();
}
}
return null;
}
}
代码示例来源:origin: toplink.essentials/toplink-essentials
/**
* INTERNAL:
*
* Return the temporal type for this accessor. Assumes there is a @Temporal.
*/
public String getTemporalType() {
Temporal temporal = getAnnotation(Temporal.class);
return temporal.value().name();
}
代码示例来源:origin: com.mysema.querydsl/querydsl-jpa-codegen
private Type getPropertyType(Attribute<?, ?> p, Type propertyType) {
Temporal temporal = ((AnnotatedElement)p.getJavaMember()).getAnnotation(Temporal.class);
if (temporal != null) {
switch (temporal.value()) {
case DATE: propertyType = propertyType.as(TypeCategory.DATE); break;
case TIME: propertyType = propertyType.as(TypeCategory.TIME); break;
case TIMESTAMP: propertyType = propertyType.as(TypeCategory.DATETIME); break;
}
}
return propertyType;
}
代码示例来源:origin: com.querydsl/querydsl-jpa-codegen
private Type getPropertyType(Attribute<?, ?> p, Type propertyType) {
Temporal temporal = ((AnnotatedElement) p.getJavaMember()).getAnnotation(Temporal.class);
if (temporal != null) {
switch (temporal.value()) {
case DATE: propertyType = propertyType.as(TypeCategory.DATE); break;
case TIME: propertyType = propertyType.as(TypeCategory.TIME); break;
case TIMESTAMP: propertyType = propertyType.as(TypeCategory.DATETIME); break;
}
}
return propertyType;
}
代码示例来源:origin: org.hibernate.orm/hibernate-core
private void normalSupplementalDetails(
XProperty navigableXProperty,
MetadataBuildingContext buildingContext) {
final Enumerated mapKeyEnumeratedAnn = navigableXProperty.getAnnotation( Enumerated.class );
if ( mapKeyEnumeratedAnn != null ) {
enumType = mapKeyEnumeratedAnn.value();
}
final Temporal mapKeyTemporalAnn = navigableXProperty.getAnnotation( Temporal.class );
if ( mapKeyTemporalAnn != null ) {
temporalPrecision = mapKeyTemporalAnn.value();
}
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
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();
}
}
代码示例来源:origin: io.ebean/ebean
private void readTemporal(Temporal temporal, DeployBeanProperty prop) {
TemporalType type = temporal.value();
if (type == TemporalType.DATE) {
prop.setDbType(Types.DATE);
} else if (type == TemporalType.TIMESTAMP) {
prop.setDbType(Types.TIMESTAMP);
} else if (type == TemporalType.TIME) {
prop.setDbType(Types.TIME);
} else {
throw new PersistenceException("Unhandled type " + type);
}
}
代码示例来源:origin: org.avaje/ebean
private void readTemporal(Temporal temporal, DeployBeanProperty prop) {
TemporalType type = temporal.value();
if (type.equals(TemporalType.DATE)) {
prop.setDbType(Types.DATE);
} else if (type.equals(TemporalType.TIMESTAMP)) {
prop.setDbType(Types.TIMESTAMP);
} else if (type.equals(TemporalType.TIME)) {
prop.setDbType(Types.TIME);
} else {
throw new PersistenceException("Unhandled type " + type);
}
}
代码示例来源:origin: org.avaje.ebean/ebean
private void readTemporal(Temporal temporal, DeployBeanProperty prop) {
TemporalType type = temporal.value();
if (type.equals(TemporalType.DATE)) {
prop.setDbType(Types.DATE);
} else if (type.equals(TemporalType.TIMESTAMP)) {
prop.setDbType(Types.TIMESTAMP);
} else if (type.equals(TemporalType.TIME)) {
prop.setDbType(Types.TIME);
} else {
throw new PersistenceException("Unhandled type " + type);
}
}
内容来源于网络,如有侵权,请联系作者删除!