本文整理汇总了Java中org.netbeans.jpa.modeler.spec.TemporalType类的典型用法代码示例。如果您正苦于以下问题:Java TemporalType类的具体用法?Java TemporalType怎么用?Java TemporalType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TemporalType类属于org.netbeans.jpa.modeler.spec包,在下文中一共展示了TemporalType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processVersion
import org.netbeans.jpa.modeler.spec.TemporalType; //导入依赖的package包/类
protected void processVersion(List<Version> parsedVersions) {
if (parsedVersions == null) {
return;
}
for (Version parsedVersion : parsedVersions) {
VariableDefSnippet variableDef = getVariableDef(parsedVersion);
ColumnDefSnippet columnDef = getColumnDef(parsedVersion.getColumn());
variableDef.setType(parsedVersion.getAttributeType());
variableDef.setFunctionalType(parsedVersion.isOptionalReturnType());
variableDef.setVersion(true);
variableDef.setColumnDef(columnDef);
TemporalType parsedTemporalType = parsedVersion.getTemporal();
TemporalSnippet temporal = null;
if (parsedTemporalType != null) {
temporal = new TemporalSnippet();
temporal.setValue(parsedTemporalType);
}
variableDef.setTemporal(temporal);
}
}
示例2: loadAttribute
import org.netbeans.jpa.modeler.spec.TemporalType; //导入依赖的package包/类
@Override
protected void loadAttribute(Element element, VariableElement variableElement, ExecutableElement getterElement) {
super.loadAttribute(element, variableElement, getterElement);
this.column = new Column().load(element, null);
this.access = AccessType.load(element);
this.temporal = TemporalType.load(element, null);
this.setAttributeType(variableElement.asType().toString());
this.setAttributeConstraints(JavaSourceParserUtil.getBeanValidation(element));
}
示例3: setTemporal
import org.netbeans.jpa.modeler.spec.TemporalType; //导入依赖的package包/类
public static void setTemporal(MapKeyAccessor accessor, TemporalType temporalType) {
if (temporalType == null) {
return;
}
TemporalMetadata temporalMetadata = new TemporalMetadata();
temporalMetadata.setTemporalType(temporalType.toString());
accessor.setMapKeyTemporal(temporalMetadata);
}
示例4: setValue
import org.netbeans.jpa.modeler.spec.TemporalType; //导入依赖的package包/类
public void setValue(TemporalType parsedTemporalType) {
if (parsedTemporalType.equals(TemporalType.DATE)) {
this.setValue(TEMPORAL_DATE);
} else if (parsedTemporalType.equals(TemporalType.TIME)) {
this.setValue(TEMPORAL_TIME);
} else if (parsedTemporalType.equals(TemporalType.TIMESTAMP)) {
this.setValue(TEMPORAL_TIMESTAMP);
}
}
示例5: selectedTemporalType
import org.netbeans.jpa.modeler.spec.TemporalType; //导入依赖的package包/类
private void selectedTemporalType(TemporalType temporalType) {
if (temporalType != null) {
type_ComboBox.setSelectedItem(TEMPORAL);
if (temporalType == TemporalType.DATE) {
Date_RadioButton.setSelected(true);
} else if (temporalType == TemporalType.TIME) {
Time_RadioButton.setSelected(true);
} else if (temporalType == TemporalType.TIMESTAMP) {
TimeStamp_RadioButton.setSelected(true);
}
} else {
type_ComboBox.setSelectedItem(DEFAULT);
}
}
示例6: getSelectedTemporalType
import org.netbeans.jpa.modeler.spec.TemporalType; //导入依赖的package包/类
private TemporalType getSelectedTemporalType() {
if (Date_RadioButton.isSelected()) {
return TemporalType.DATE;
} else if (Time_RadioButton.isSelected()) {
return TemporalType.TIME;
} else if (TimeStamp_RadioButton.isSelected()) {
return TemporalType.TIMESTAMP;
}
return null;
}
示例7: loadAttribute
import org.netbeans.jpa.modeler.spec.TemporalType; //导入依赖的package包/类
@Override
public void loadAttribute(EntityMappings entityMappings, Element element, VariableElement variableElement, ExecutableElement getterElement, AnnotationMirror relationAnnotationMirror) {
super.loadAttribute(entityMappings, element, variableElement, getterElement, relationAnnotationMirror);
this.mappedBy = (String) JavaSourceParserUtil.findAnnotationValue(relationAnnotationMirror, "mappedBy");
this.orderBy = OrderBy.load(element, variableElement);
this.orderColumn = OrderColumn.load(element, variableElement);
this.collectionType = ((DeclaredType) variableElement.asType()).asElement().toString();
Class collectionTypeClass = null;
try {
collectionTypeClass = Class.forName(this.collectionType);
} catch (ClassNotFoundException ex) {
}
boolean mapKeyExist = collectionTypeClass!=null && Map.class.isAssignableFrom(collectionTypeClass);
DeclaredType declaredType = (DeclaredType) JavaSourceParserUtil.findAnnotationValue(relationAnnotationMirror, "targetEntity");
if (declaredType == null) {
if (variableElement.asType() instanceof ErrorType) { //variable => "<any>"
throw new TypeNotPresentException(this.name + " type not found", null);
}
declaredType = (DeclaredType) ((DeclaredType) variableElement.asType()).getTypeArguments().get(mapKeyExist?1:0);
}
this.targetEntity = declaredType.asElement().getSimpleName().toString();
if (mapKeyExist) {
this.mapKeyConvert = Convert.load(element, mapKeyExist, true);
this.mapKey = new MapKey().load(element, null);
this.mapKeyType = this.mapKey!=null?MapKeyType.EXT:MapKeyType.NEW;
DeclaredType keyDeclaredType = MapKeyClass.getDeclaredType(element);
if (keyDeclaredType == null) {
keyDeclaredType = (DeclaredType) ((DeclaredType) variableElement.asType()).getTypeArguments().get(0);
}
if (isEmbeddableClass(keyDeclaredType.asElement())) {
loadEmbeddableClass(entityMappings, element, variableElement, keyDeclaredType);
this.mapKeyAttributeType = getSimpleClassName(keyDeclaredType.toString());
} else if (isEntityClass(keyDeclaredType.asElement())) {
loadEntityClass(entityMappings, element, variableElement, keyDeclaredType);
this.mapKeyAttributeType = getSimpleClassName(keyDeclaredType.toString());
} else {
this.mapKeyAttributeType = keyDeclaredType.toString();
}
this.mapKeyColumn = new Column().load(element, JavaSourceParserUtil.findAnnotation(element, MAP_KEY_COLUMN_FQN));
this.mapKeyTemporal = TemporalType.load(element, JavaSourceParserUtil.findAnnotation(element, MAP_KEY_TEMPORAL_FQN));
this.mapKeyEnumerated = EnumType.load(element, JavaSourceParserUtil.findAnnotation(element, MAP_KEY_ENUMERATED_FQN));
AnnotationMirror joinColumnsAnnotationMirror = JavaSourceParserUtil.findAnnotation(element, MAP_KEY_JOIN_COLUMNS_FQN);
if (joinColumnsAnnotationMirror != null) {
List joinColumnsAnnot = (List) JavaSourceParserUtil.findAnnotationValue(joinColumnsAnnotationMirror, "value");
if (joinColumnsAnnot != null) {
for (Object joinColumnObj : joinColumnsAnnot) {
this.getMapKeyJoinColumn().add(new JoinColumn().load(element, (AnnotationMirror) joinColumnObj));
}
}
} else {
AnnotationMirror joinColumnAnnotationMirror = JavaSourceParserUtil.findAnnotation(element, MAP_KEY_JOIN_COLUMN_FQN);
if (joinColumnAnnotationMirror != null) {
this.getMapKeyJoinColumn().add(new JoinColumn().load(element, joinColumnAnnotationMirror));
}
}
this.mapKeyForeignKey = ForeignKey.load(element, null);
this.getMapKeyAttributeOverride().addAll(AttributeOverride.load(element));
}
}
示例8: processBasic
import org.netbeans.jpa.modeler.spec.TemporalType; //导入依赖的package包/类
protected void processBasic(List<Basic> parsedBasics) {
if (parsedBasics == null) {
return;
}
for (Basic parsedBasic : parsedBasics) {
ColumnDefSnippet columnDef = getColumnDef(parsedBasic.getColumn());
EnumType parsedEnumType = parsedBasic.getEnumerated();
EnumeratedSnippet enumerated = null;
if (parsedEnumType != null) {
enumerated = new EnumeratedSnippet();
enumerated.setValue(parsedEnumType);
}
TemporalType parsedTemporalType = parsedBasic.getTemporal();
TemporalSnippet temporal = null;
if (parsedTemporalType != null) {
temporal = new TemporalSnippet();
temporal.setValue(parsedTemporalType);
}
FetchType parsedFetchType = parsedBasic.getFetch();
BasicSnippet basic = new BasicSnippet();
if (parsedFetchType != null) {
basic.setFetchType(parsedFetchType.value());
}
if (parsedBasic.getOptional() != null) {
basic.setOptional(parsedBasic.getOptional());
}
Lob parsedLob = parsedBasic.getLob();
VariableDefSnippet variableDef = getVariableDef(parsedBasic);
variableDef.setBasic(basic);
variableDef.setColumnDef(columnDef);
variableDef.setEnumerated(enumerated);
variableDef.setTemporal(temporal);
variableDef.setType(parsedBasic.getAttributeType());
variableDef.setFunctionalType(parsedBasic.isOptionalReturnType());
variableDef.setConverts(processConverts(Collections.singletonList(parsedBasic.getConvert())));
variableDef.setLob(parsedLob != null);
}
}
示例9: processElementCollection
import org.netbeans.jpa.modeler.spec.TemporalType; //导入依赖的package包/类
protected void processElementCollection(List<ElementCollection> parsedElementCollections) {
if (parsedElementCollections == null) {
return;
}
for (ElementCollection parsedElementCollection : parsedElementCollections) {
CollectionTableSnippet collectionTable = getCollectionTable(parsedElementCollection.getCollectionTable());
FetchType parsedFetchType = parsedElementCollection.getFetch();
ElementCollectionSnippet elementCollection = new ElementCollectionSnippet();
elementCollection.setCollectionType(parsedElementCollection.getCollectionType());
elementCollection.setCollectionImplType(parsedElementCollection.getCollectionImplType());
elementCollection.setMapKeySnippet(updateMapKeyAttributeSnippet(parsedElementCollection));
elementCollection.setTargetClass(parsedElementCollection.getAttributeType());
if (parsedElementCollection.getConnectedClass() != null) {
elementCollection.setTargetClassPackage(parsedElementCollection.getConnectedClass().getAbsolutePackage(rootPackageName));
}
if (parsedFetchType != null) {
elementCollection.setFetchType(parsedFetchType.value());
}
Lob parsedLob = parsedElementCollection.getLob();
VariableDefSnippet variableDef = getVariableDef(parsedElementCollection);
variableDef.setElementCollection(elementCollection);
variableDef.setCollectionTable(collectionTable);
if (parsedElementCollection.getOrderBy() != null) {
variableDef.setOrderBy(new OrderBySnippet(parsedElementCollection.getOrderBy()));
} else if (parsedElementCollection.getOrderColumn() != null) {
variableDef.setOrderColumn(new OrderColumnSnippet(parsedElementCollection.getOrderColumn()));
}
if (parsedLob != null) {
variableDef.setLob(true);
}
if (parsedElementCollection.getConnectedClass() == null) {//if not embeddable
EnumType parsedEnumType = parsedElementCollection.getEnumerated();
EnumeratedSnippet enumerated = null;
if (parsedEnumType != null) {
enumerated = new EnumeratedSnippet();
enumerated.setValue(parsedEnumType);
}
TemporalType parsedTemporalType = parsedElementCollection.getTemporal();
TemporalSnippet temporal = null;
if (parsedTemporalType != null) {
temporal = new TemporalSnippet();
temporal.setValue(parsedTemporalType);
}
variableDef.setEnumerated(enumerated);
variableDef.setTemporal(temporal);
variableDef.setColumnDef(getColumnDef(parsedElementCollection.getColumn()));
} else {
processInternalAttributeOverride(variableDef, parsedElementCollection.getAttributeOverride());
processInternalAssociationOverride(variableDef, parsedElementCollection.getAssociationOverride());
}
List<Convert> converts = new ArrayList<>();
converts.addAll(parsedElementCollection.getMapKeyConverts());
converts.addAll(parsedElementCollection.getConverts());
variableDef.setConverts(processConverts(converts));
}
}
示例10: processId
import org.netbeans.jpa.modeler.spec.TemporalType; //导入依赖的package包/类
protected void processId(List<Id> parsedIds) {
// if (parsedAttributes == null) {
// return;
// }
//
// List<ParsedId> parsedIds = parsedAttributes.getId();
for (Id parsedId : parsedIds) {
VariableDefSnippet variableDef = getVariableDef(parsedId);
variableDef.setType(parsedId.getAttributeType());
variableDef.setFunctionalType(parsedId.isOptionalReturnType());
variableDef.setPrimaryKey(true);
Column parsedColumn = parsedId.getColumn();
if (parsedColumn != null) {
ColumnDefSnippet columnDef = getColumnDef(parsedColumn);
variableDef.setColumnDef(columnDef);
}
GeneratedValue parsedGeneratedValue = parsedId.getGeneratedValue();
if (parsedGeneratedValue != null && parsedGeneratedValue.getStrategy() != null) {
GeneratedValueSnippet generatedValue = new GeneratedValueSnippet();
generatedValue.setGenerator(parsedGeneratedValue.getGenerator());
generatedValue.setStrategy("GenerationType." + parsedGeneratedValue.getStrategy().value());
variableDef.setGeneratedValue(generatedValue);
SequenceGenerator parsedSequenceGenerator
= parsedId.getSequenceGenerator();
if (parsedSequenceGenerator != null) {
SequenceGeneratorSnippet sequenceGenerator = processSequenceGenerator(parsedSequenceGenerator);
variableDef.setSequenceGenerator(sequenceGenerator);
}
TableGenerator parsedTableGenerator = parsedId.getTableGenerator();
if (parsedTableGenerator != null) {
variableDef.setTableGenerator(processTableGenerator(parsedTableGenerator));
}
}
TemporalType parsedTemporalType = parsedId.getTemporal();
TemporalSnippet temporal = null;
if (parsedTemporalType != null) {
temporal = new TemporalSnippet();
temporal.setValue(parsedTemporalType);
}
variableDef.setTemporal(temporal);
}
}
示例11: processBasic
import org.netbeans.jpa.modeler.spec.TemporalType; //导入依赖的package包/类
protected void processBasic(List<Basic> parsedBasics) {
if (parsedBasics == null) {
return;
}
for (Basic parsedBasic : parsedBasics) {
ColumnDefSnippet columnDef = getColumnDef(parsedBasic.getColumn());
EnumType parsedEnumType = parsedBasic.getEnumerated();
EnumeratedSnippet enumerated = null;
if (parsedEnumType != null) {
enumerated = new EnumeratedSnippet();
if (parsedEnumType.equals(EnumType.ORDINAL)) {
enumerated.setValue(EnumeratedSnippet.TYPE_ORDINAL);
} else {
enumerated.setValue(EnumeratedSnippet.TYPE_STRING);
}
}
FetchType parsedFetchType = parsedBasic.getFetch();
BasicSnippet basic = new BasicSnippet();
if (parsedFetchType != null) {
basic.setFetchType(parsedFetchType.value());
}
if (parsedBasic.getOptional() != null) {
basic.setOptional(parsedBasic.getOptional());
}
TemporalType parsedTemporal = parsedBasic.getTemporal();
Lob parsedLob = parsedBasic.getLob();
VariableDefSnippet variableDef = getVariableDef(parsedBasic.getName());
variableDef.setBasic(basic);
variableDef.setColumnDef(columnDef);
variableDef.setEnumerated(enumerated);
variableDef.setType(parsedBasic.getAttributeType());
if (parsedTemporal != null) {
variableDef.setTemporal(true);
variableDef.setTemporalType(
TEMPORAL_TYPE_PREFIX + parsedTemporal.value());
}
if (parsedLob != null) {
variableDef.setLob(true);
}
}
}
示例12: processElementCollection
import org.netbeans.jpa.modeler.spec.TemporalType; //导入依赖的package包/类
protected void processElementCollection(List<ElementCollection> parsedElementCollections) {
if (parsedElementCollections == null) {
return;
}
for (ElementCollection parsedElementCollection : parsedElementCollections) {
ColumnDefSnippet columnDef = getColumnDef(parsedElementCollection.getColumn());
EnumType enumType = parsedElementCollection.getEnumerated();
CollectionTableSnippet collectionTable = getCollectionTable(parsedElementCollection.getCollectionTable());
EnumeratedSnippet enumerated = null;
if (enumType != null) {
enumerated = new EnumeratedSnippet();
if (enumType.equals(EnumType.ORDINAL)) {
enumerated.setValue(EnumeratedSnippet.TYPE_ORDINAL);
} else {
enumerated.setValue(EnumeratedSnippet.TYPE_STRING);
}
}
FetchType parsedFetchType = parsedElementCollection.getFetch();
ElementCollectionSnippet elementCollection = new ElementCollectionSnippet();
elementCollection.setCollectionType(parsedElementCollection.getCollectionType());
elementCollection.setTargetClass(parsedElementCollection.getTargetClass());
if (parsedFetchType != null) {
elementCollection.setFetchType(parsedFetchType.value());
}
TemporalType parsedTemporal = parsedElementCollection.getTemporal();
Lob parsedLob = parsedElementCollection.getLob();
VariableDefSnippet variableDef = getVariableDef(parsedElementCollection.getName());
variableDef.setElementCollection(elementCollection);
variableDef.setCollectionTable(collectionTable);
variableDef.setColumnDef(columnDef);
variableDef.setEnumerated(enumerated);
if (parsedTemporal != null) {
variableDef.setTemporal(true);
variableDef.setTemporalType(
TEMPORAL_TYPE_PREFIX + parsedTemporal.value());
}
if (parsedLob != null) {
variableDef.setLob(true);
}
List<AttributeOverride> attributedOverrrides
= parsedElementCollection.getAttributeOverride();
if (attributedOverrrides != null
&& !attributedOverrrides.isEmpty()
&& classDef.getAttributeOverrides() == null) {
classDef.setAttributeOverrides(new AttributeOverridesSnippet());
}
for (AttributeOverride parsedAttributeOverride : attributedOverrrides) {
AttributeOverrideSnippet attributeOverride = new AttributeOverrideSnippet();
ColumnDefSnippet columnDefAttributeOverride = getColumnDef(
parsedAttributeOverride.getColumn());
attributeOverride.setColumnDef(columnDefAttributeOverride);
attributeOverride.setName(parsedAttributeOverride.getName());
classDef.getAttributeOverrides().addAttributeOverrides(
attributeOverride);
}
}
}
示例13: getValue
import org.netbeans.jpa.modeler.spec.TemporalType; //导入依赖的package包/类
@Override
public BaseAttribute getValue() {
if (baseAttribute instanceof Basic) {
Basic basic = (Basic) baseAttribute;
basic.setLob(null);
basic.setEnumerated(null);
basic.setTemporal(null);
if (type_ComboBox.getSelectedItem().equals("Enumerated")) {
if (String_RadioButton.isSelected()) {
basic.setEnumerated(EnumType.STRING);
} else {
basic.setEnumerated(EnumType.ORDINAL);
}
} else if (type_ComboBox.getSelectedItem().equals("Lob")) {
basic.setLob(new Lob());
} else if (type_ComboBox.getSelectedItem().equals("Temporal")) {
if (Date_RadioButton.isSelected()) {
basic.setTemporal(TemporalType.DATE);
} else if (Time_RadioButton.isSelected()) {
basic.setTemporal(TemporalType.TIME);
} else if (TimeStamp_RadioButton.isSelected()) {
basic.setTemporal(TemporalType.TIMESTAMP);
}
}
}
if (baseAttribute instanceof ElementCollection) {
ElementCollection elementCollection = (ElementCollection) baseAttribute;
elementCollection.setLob(null);
elementCollection.setEnumerated(null);
elementCollection.setTemporal(null);
if (type_ComboBox.getSelectedItem().equals("Enumerated")) {
if (String_RadioButton.isSelected()) {
elementCollection.setEnumerated(EnumType.STRING);
} else {
elementCollection.setEnumerated(EnumType.ORDINAL);
}
} else if (type_ComboBox.getSelectedItem().equals("Lob")) {
elementCollection.setLob(new Lob());
} else if (type_ComboBox.getSelectedItem().equals("Temporal")) {
if (Date_RadioButton.isSelected()) {
elementCollection.setTemporal(TemporalType.DATE);
} else if (Time_RadioButton.isSelected()) {
elementCollection.setTemporal(TemporalType.TIME);
} else if (TimeStamp_RadioButton.isSelected()) {
elementCollection.setTemporal(TemporalType.TIMESTAMP);
}
}
} else if (baseAttribute instanceof Id) {
Id id = (Id) baseAttribute;
id.setTemporal(null);
if (type_ComboBox.getSelectedItem().equals("Temporal")) {
if (Date_RadioButton.isSelected()) {
id.setTemporal(TemporalType.DATE);
} else if (Time_RadioButton.isSelected()) {
id.setTemporal(TemporalType.TIME);
} else if (TimeStamp_RadioButton.isSelected()) {
id.setTemporal(TemporalType.TIMESTAMP);
}
}
} else if (baseAttribute instanceof Transient) {
// Transient _transient = (Transient) baseAttribute;
} else if (baseAttribute instanceof Version) {
Version version = (Version) baseAttribute;
version.setTemporal(null);
if (type_ComboBox.getSelectedItem().equals("Temporal")) {
if (Date_RadioButton.isSelected()) {
version.setTemporal(TemporalType.DATE);
} else if (Time_RadioButton.isSelected()) {
version.setTemporal(TemporalType.TIME);
} else if (TimeStamp_RadioButton.isSelected()) {
version.setTemporal(TemporalType.TIMESTAMP);
}
}
}
baseAttribute.setAttributeType(dataType_ComboBox.getSelectedItem().toString());
return baseAttribute;
}
示例14: getTemporal
import org.netbeans.jpa.modeler.spec.TemporalType; //导入依赖的package包/类
/**
* Gets the value of the temporal property.
*
* @return possible object is {@link TemporalType }
*
*/
@Override
public TemporalType getTemporal() {
return temporal;
}
示例15: setTemporal
import org.netbeans.jpa.modeler.spec.TemporalType; //导入依赖的package包/类
/**
* Sets the value of the temporal property.
*
* @param value allowed object is {@link TemporalType }
*
*/
@Override
public void setTemporal(TemporalType value) {
this.temporal = value;
}