-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
145 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 27 additions & 2 deletions
29
src/main/java/org/fugerit/java/query/export/meta/BasicMetaField.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,36 @@ | ||
package org.fugerit.java.query.export.meta; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@AllArgsConstructor | ||
import java.sql.Timestamp; | ||
|
||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class BasicMetaField implements MetaField { | ||
|
||
@Getter private String stringValue; | ||
public BasicMetaField(String stringValue) { | ||
this( TYPE_STRING, stringValue, null, null ); | ||
} | ||
|
||
public BasicMetaField(String stringValue, Long longValue) { | ||
this( TYPE_NUMBER, stringValue, longValue, null ); | ||
} | ||
|
||
public BasicMetaField(String stringValue, Timestamp timestampValue) { | ||
this( TYPE_DATE, stringValue, null, timestampValue ); | ||
} | ||
|
||
@Getter | ||
private int type; | ||
|
||
@Getter | ||
private String stringValue; | ||
|
||
@Getter | ||
private Long numberValue; | ||
|
||
@Getter | ||
private Timestamp timestampValue; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 22 additions & 2 deletions
24
src/main/java/org/fugerit/java/query/export/meta/MetaField.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,27 @@ | ||
package org.fugerit.java.query.export.meta; | ||
|
||
import java.sql.Timestamp; | ||
|
||
public interface MetaField { | ||
|
||
public String getStringValue(); | ||
|
||
public static final int TYPE_STRING = 1; | ||
|
||
public static final int TYPE_NUMBER = 2; | ||
|
||
public static final int TYPE_DATE = 3; | ||
|
||
String getStringValue(); | ||
|
||
default int getType() { | ||
return TYPE_STRING; | ||
} | ||
|
||
default Long getNumberValue() { | ||
return null; | ||
} | ||
|
||
default Timestamp getTimestampValue() { | ||
return null; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/test/java/test/org/fugerit/java/query/export/tool/TestModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package test.org.fugerit.java.query.export.tool; | ||
|
||
import org.fugerit.java.query.export.meta.MetaField; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
public class TestModel { | ||
|
||
@Test | ||
public void testMetaField() { | ||
MetaField field = new MetaField() { | ||
@Override | ||
public String getStringValue() { | ||
return ""; | ||
} | ||
}; | ||
Assert.assertNull( field.getNumberValue() ); | ||
Assert.assertNull( field.getTimestampValue() ); | ||
Assert.assertEquals( "", field.getStringValue() ); | ||
Assert.assertEquals( MetaField.TYPE_STRING, field.getType() ); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters