Skip to content

Commit

Permalink
Restructured parser hierarchy
Browse files Browse the repository at this point in the history
  • Loading branch information
cioccarellia committed Nov 30, 2020
1 parent 272bedd commit ff0d085
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 16 deletions.
18 changes: 9 additions & 9 deletions gradle/android_bintray_config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ if (module_name == null || module_name.isEmpty()) {
}

publish {
bintrayUser = BINTRAY_USER
userOrg = BINTRAY_ORG
bintrayKey = BINTRAY_API_KEY
bintrayUser = BINTRAY_USER
userOrg = BINTRAY_ORG
bintrayKey = BINTRAY_API_KEY

groupId = library.publish_group
artifactId = library.artifact
groupId = library.publish_group
artifactId = library.artifact

publishVersion = library.publish_version
publishVersion = library.publish_version

desc = library.description
website = library.website
dryRun = false
desc = library.description
website = library.website
dryRun = false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Designed and developed by Andrea Cioccarelli (@cioccarellia)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.cioccarellia.kite.resparser

/**
* [KiteParser] which has precisely 1 input and 1 output
* */
abstract class KiteCustomResParser<in R, out O> : KiteParser()
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ package com.cioccarellia.kite.resparser
* */
abstract class KiteResParser<in R, out O> : KiteParser() {
abstract operator fun get(resource: R): O
fun fetch(resource: R): O = get(resource)
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ package com.cioccarellia.kite.resparser.resources

import androidx.annotation.FractionRes
import androidx.annotation.IntRange
import com.cioccarellia.kite.resparser.KiteParser
import com.cioccarellia.kite.resparser.KiteCustomResParser

/**
* KiteFraction Implementation
* */
class KiteFraction : KiteParser() {
class KiteFraction : KiteCustomResParser<@FractionRes Int, Float>() {
operator fun get(
@FractionRes @IntRange(from = 1) fraction: Int,
@IntRange(from = 2) base: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@

package com.cioccarellia.kite.resparser.resources

import com.cioccarellia.kite.resparser.KiteParser
import com.cioccarellia.kite.resparser.KiteCustomResParser

/**
* KiteIdentifier Implementation
* */
class KiteIdentifier : KiteParser() {
class KiteIdentifier : KiteCustomResParser<String, Int>() {
operator fun get(
name: String,
defType: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ package com.cioccarellia.kite.resparser.resources

import androidx.annotation.IntRange
import androidx.annotation.PluralsRes
import com.cioccarellia.kite.resparser.KiteParser
import com.cioccarellia.kite.resparser.KiteCustomResParser

/**
* KitePlurals Implementation
* */
class KitePlurals : KiteParser() {
class KitePlurals : KiteCustomResParser<@PluralsRes Int, String>() {
operator fun get(
@PluralsRes @IntRange(from = 1) plurals: Int,
quantity: Int
Expand Down

0 comments on commit ff0d085

Please sign in to comment.