-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from SchwarzIT/feature/kotlinPrepare
Feature/kotlin prepare
- Loading branch information
Showing
31 changed files
with
373 additions
and
474 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
16 changes: 0 additions & 16 deletions
16
couchbase-entity-api/src/main/java/kaufland/com/coachbasebinderapi/Constant.java
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
couchbase-entity-api/src/main/java/kaufland/com/coachbasebinderapi/DefaultValue.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,33 @@ | ||
package kaufland.com.coachbasebinderapi; | ||
|
||
import java.lang.reflect.Array; | ||
import java.util.Map; | ||
import java.util.stream.Stream; | ||
|
||
public class DefaultValue { | ||
|
||
private static final Double DOUBLE_DEFAULT = Double.valueOf(0d); | ||
private static final Float FLOAT_DEFAULT = Float.valueOf(0f); | ||
|
||
public static <T> T get(Class<T> type) { | ||
if (type == boolean.class) { | ||
return (T) Boolean.FALSE; | ||
} else if (type == char.class) { | ||
return (T) Character.valueOf('\0'); | ||
} else if (type == byte.class) { | ||
return (T) Byte.valueOf((byte) 0); | ||
} else if (type == short.class) { | ||
return (T) Short.valueOf((short) 0); | ||
} else if (type == int.class) { | ||
return (T) Integer.valueOf(0); | ||
} else if (type == long.class) { | ||
return (T) Long.valueOf(0L); | ||
} else if (type == float.class) { | ||
return (T) FLOAT_DEFAULT; | ||
} else if (type == double.class) { | ||
return (T) DOUBLE_DEFAULT; | ||
} else { | ||
return null; | ||
} | ||
} | ||
} |
15 changes: 0 additions & 15 deletions
15
couchbase-entity-api/src/main/java/kaufland/com/coachbasebinderapi/Field.java
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
couchbase-entity-api/src/main/java/kaufland/com/coachbasebinderapi/Field.kt
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,10 @@ | ||
package kaufland.com.coachbasebinderapi | ||
|
||
import com.sun.org.apache.xpath.internal.operations.Bool | ||
import java.lang.annotation.RetentionPolicy | ||
|
||
|
||
import kotlin.reflect.KClass | ||
|
||
@Retention(AnnotationRetention.BINARY) | ||
annotation class Field(val name: String = "", val type: KClass<out Any>, val list: Boolean = false, val defaultValue: String = "", val readonly: Boolean = false) |
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
6 changes: 6 additions & 0 deletions
6
couchbase-entity-api/src/main/java/kaufland/com/coachbasebinderapi/MapSupport.kt
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,6 @@ | ||
package kaufland.com.coachbasebinderapi | ||
|
||
interface MapSupport { | ||
|
||
fun toMap(): Map<String, Any>? | ||
} |
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
19 changes: 19 additions & 0 deletions
19
couchbase-entity/src/main/java/com/kaufland/generation/MapSupportGeneration.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,19 @@ | ||
package com.kaufland.generation; | ||
|
||
import com.kaufland.model.entity.BaseEntityHolder; | ||
import com.kaufland.util.TypeUtil; | ||
import com.squareup.javapoet.MethodSpec; | ||
|
||
import javax.lang.model.element.Modifier; | ||
|
||
public class MapSupportGeneration { | ||
|
||
public static MethodSpec toMap(BaseEntityHolder holder) { | ||
MethodSpec.Builder toMapBuilder = MethodSpec.methodBuilder("toMap").addModifiers(Modifier.PUBLIC). | ||
returns(TypeUtil.createMapStringObject()). | ||
addStatement("return toMap(this)"); | ||
|
||
return toMapBuilder.build(); | ||
} | ||
|
||
} |
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
Oops, something went wrong.