Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ plugins {
id("io.codearte.nexus-staging") version "0.30.0"
id("io.gitlab.arturbosch.detekt").version("1.23.8")
id("info.solidsoft.pitest").version("1.19.0-rc.2")
id("org.jetbrains.kotlinx.kover") version "0.9.4"
id("org.jetbrains.kotlinx.kover") version "0.9.11"
}

java {
Expand Down
8 changes: 4 additions & 4 deletions src/main/kotlin/org/xpathqs/core/annotations/NoXpathBase.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 XPATH-QS
* Copyright (c) 2026 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -22,9 +22,9 @@

package org.xpathqs.core.annotations

import org.xpathqs.core.selector.base.BaseSelector
import org.xpathqs.core.selector.group.GroupSelector
import org.xpathqs.core.selector.xpath.XpathSelector
import org.xpathqs.core.selector.BaseSelector
import org.xpathqs.core.selector.GroupSelector
import org.xpathqs.core.selector.XpathSelector

/**
* Annotation will remove base xpath from result xpath
Expand Down
8 changes: 4 additions & 4 deletions src/main/kotlin/org/xpathqs/core/annotations/SingleBase.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 XPATH-QS
* Copyright (c) 2026 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -22,9 +22,9 @@

package org.xpathqs.core.annotations

import org.xpathqs.core.selector.selector.Selector
import org.xpathqs.core.selector.group.GroupSelector
import org.xpathqs.core.selector.xpath.XpathSelector
import org.xpathqs.core.selector.Selector
import org.xpathqs.core.selector.GroupSelector
import org.xpathqs.core.selector.XpathSelector
import org.xpathqs.core.selector.block.Block

/**
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/org/xpathqs/core/model/AssociationFinder.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 XPATH-QS
* Copyright (c) 2026 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -22,7 +22,7 @@

package org.xpathqs.core.model

import org.xpathqs.core.selector.base.BaseSelector
import org.xpathqs.core.selector.BaseSelector
import java.lang.reflect.Field


Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/org/xpathqs/core/model/IModelAssociation.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 XPATH-QS
* Copyright (c) 2026 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -22,7 +22,7 @@

package org.xpathqs.core.model

import org.xpathqs.core.selector.base.BaseSelector
import org.xpathqs.core.selector.BaseSelector
import java.lang.reflect.Field

interface IModelAssociation {
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/org/xpathqs/core/model/ModelAssociation.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 XPATH-QS
* Copyright (c) 2026 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -23,7 +23,7 @@
package org.xpathqs.core.model

import org.xpathqs.core.reflection.toField
import org.xpathqs.core.selector.base.BaseSelector
import org.xpathqs.core.selector.BaseSelector
import java.lang.reflect.Field
import kotlin.reflect.KProperty

Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/org/xpathqs/core/model/NameAssociation.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 XPATH-QS
* Copyright (c) 2026 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -22,7 +22,7 @@

package org.xpathqs.core.model

import org.xpathqs.core.selector.base.BaseSelector
import org.xpathqs.core.selector.BaseSelector
import org.xpathqs.core.selector.extensions.simpleName
import java.lang.reflect.Field

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
package org.xpathqs.core.reflection

import org.xpathqs.core.selector.NullSelector
import org.xpathqs.core.selector.base.BaseSelector
import org.xpathqs.core.selector.BaseSelector
import org.xpathqs.core.selector.base.BaseSelectorProps
import org.xpathqs.core.selector.base.ISelector
import org.xpathqs.core.selector.ISelector
import org.xpathqs.core.selector.block.Block
import org.xpathqs.core.selector.group.GroupSelector
import org.xpathqs.core.selector.GroupSelector
import kotlin.reflect.KClass
import kotlin.reflect.KProperty
import kotlin.reflect.full.declaredMemberProperties
Expand Down
10 changes: 5 additions & 5 deletions src/main/kotlin/org/xpathqs/core/reflection/SelectorParser.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025 XPATH-QS
* Copyright (c) 2026 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -27,14 +27,14 @@ import org.xpathqs.core.annotations.NoBase
import org.xpathqs.core.annotations.NoXpathBase
import org.xpathqs.core.annotations.SingleBase
import org.xpathqs.core.selector.NullSelector
import org.xpathqs.core.selector.base.BaseSelector
import org.xpathqs.core.selector.base.ISelector
import org.xpathqs.core.selector.BaseSelector
import org.xpathqs.core.selector.ISelector
import org.xpathqs.core.selector.base.SelectorState
import org.xpathqs.core.selector.base.hasAnnotation
import org.xpathqs.core.selector.block.Block
import org.xpathqs.core.selector.group.GroupSelector
import org.xpathqs.core.selector.GroupSelector
import org.xpathqs.core.selector.group.prefix
import org.xpathqs.core.selector.selector.Selector
import org.xpathqs.core.selector.Selector
import org.xpathqs.core.selector.selector.prefix
import kotlin.reflect.KProperty
import kotlin.reflect.full.findAnnotation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
package org.xpathqs.core.reflection

import org.xpathqs.core.selector.args.SelectorArgs
import org.xpathqs.core.selector.base.BaseSelector
import org.xpathqs.core.selector.BaseSelector
import org.xpathqs.core.selector.base.BaseSelectorProps
import org.xpathqs.core.selector.base.ISelector
import org.xpathqs.core.selector.ISelector
import org.xpathqs.core.selector.base.SelectorState
import java.lang.reflect.Field
import kotlin.reflect.KProperty
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 XPATH-QS
* Copyright (c) 2026 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -23,8 +23,7 @@
package org.xpathqs.core.reflection

import org.xpathqs.core.annotations.NoScan
import org.xpathqs.core.selector.NullSelector
import org.xpathqs.core.selector.base.BaseSelector
import org.xpathqs.core.selector.BaseSelector
import org.xpathqs.core.selector.block.Block
import kotlin.reflect.KClass
import kotlin.reflect.KProperty
Expand Down
67 changes: 67 additions & 0 deletions src/main/kotlin/org/xpathqs/core/selector/BaseSelector.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright (c) 2026 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package org.xpathqs.core.selector

import org.xpathqs.core.selector.base.BaseSelectorProps
import org.xpathqs.core.selector.base.SelectorState
import kotlin.reflect.KProperty

/**
* Base interface for the Selectors
* @param state of the Selector
* @param base link to the root element
* @param name name of the selector (used for logging purposes)
* @param props properties for building xpath queries
* @param annotations list of annotations for selector
* @param property associated field of the root object.
* It may be NULL, when there is no root object
*/
sealed interface BaseSelector: ISelector {

val state: SelectorState

val base: ISelector
override val name: String
override val fullName: String

val props: BaseSelectorProps
val annotations: Collection<Annotation>

val property: KProperty<*>?
val noBase: Boolean

/**
* Get selector's tag or an empty string
* if tag is not applicable to the Selector's type
*/
val tag: String

/**
* A holder collection for some custom properties
* which may be used for the extending the functionality via extension-functions
*
* Require #1 - map should not be cloned. It purposes only for holding some configuration constants
* @sample org.xpathqs.core.selector.base.BaseSelectorCustomPropsMapTest.r1
*/
val customPropsMap: HashMap<String, Any?>
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,52 +20,13 @@
* SOFTWARE.
*/

package org.xpathqs.core.selector.base
package org.xpathqs.core.selector

import org.xpathqs.core.selector.NullSelector
import org.xpathqs.core.selector.base.BaseSelectorProps
import org.xpathqs.core.selector.base.SelectorState
import kotlin.reflect.KProperty

/**
* Base interface for the Selectors
* @param state of the Selector
* @param base link to the root element
* @param name name of the selector (used for logging purposes)
* @param props properties for building xpath queries
* @param annotations list of annotations for selector
* @param property associated field of the root object.
* It may be NULL, when there is no root object
*/
interface BaseSelector: ISelector {

val state: SelectorState

val base: ISelector
override val name: String
override val fullName: String

val props: BaseSelectorProps
val annotations: Collection<Annotation>

val property: KProperty<*>?
val noBase: Boolean

/**
* Get selector's tag or an empty string
* if tag is not applicable to the Selector's type
*/
val tag: String

/**
* A holder collection for some custom properties
* which may be used for the extending the functionality via extension-functions
*
* Require #1 - map should not be cloned. It purposes only for holding some configuration constants
* @sample org.xpathqs.core.selector.base.BaseSelectorCustomPropsMapTest.r1
*/
val customPropsMap: HashMap<String, Any?>
}

abstract class BaseSelectorImpl(
sealed class BaseSelectorImpl(
override val state: SelectorState = SelectorState.INIT,

override val base: ISelector = NullSelector(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@
* SOFTWARE.
*/

package org.xpathqs.core.selector.compose
package org.xpathqs.core.selector

import org.xpathqs.core.selector.NullSelector
import org.xpathqs.core.selector.base.BaseSelectorImpl
import org.xpathqs.core.selector.base.ISelector
import org.xpathqs.core.selector.base.SelectorState
import org.xpathqs.core.selector.compose.ComposeSelectorProps

/**
* Class with ability to combine several selectors with the `|` operator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,9 @@
* SOFTWARE.
*/

package org.xpathqs.core.selector.group
package org.xpathqs.core.selector

import org.xpathqs.core.selector.NullSelector
import org.xpathqs.core.selector.base.BaseSelector
import org.xpathqs.core.selector.base.BaseSelectorImpl
import org.xpathqs.core.selector.base.BaseSelectorProps
import org.xpathqs.core.selector.base.ISelector
import org.xpathqs.core.selector.base.SelectorState

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 XPATH-QS
* Copyright (c) 2026 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -20,12 +20,12 @@
* SOFTWARE.
*/

package org.xpathqs.core.selector.base
package org.xpathqs.core.selector

/**
* Root Interface for the Selectors interaction
*/
interface ISelector : Cloneable {
sealed interface ISelector : Cloneable {
/**
* Build `XPATH` query
*/
Expand Down
4 changes: 1 addition & 3 deletions src/main/kotlin/org/xpathqs/core/selector/NullSelector.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 XPATH-QS
* Copyright (c) 2026 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -22,8 +22,6 @@

package org.xpathqs.core.selector

import org.xpathqs.core.selector.base.ISelector

/**
* Implementation of `Null Object` pattern for the ISelector
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@
* SOFTWARE.
*/

package org.xpathqs.core.selector.result
package org.xpathqs.core.selector

import org.xpathqs.core.selector.NullSelector
import org.xpathqs.core.selector.base.BaseSelectorImpl
import org.xpathqs.core.selector.base.BaseSelectorProps
import org.xpathqs.core.selector.base.ISelector
import org.xpathqs.core.selector.base.SelectorState

/**
Expand Down
Loading
Loading