Skip to content

Commit

Permalink
CAMEL-20333 camel-kotlin-api: added autogen Language DSL
Browse files Browse the repository at this point in the history
  • Loading branch information
iMashtak committed Feb 7, 2024
1 parent 8a15ce4 commit 6b273d0
Show file tree
Hide file tree
Showing 34 changed files with 1,972 additions and 554 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.camel.kotlin.languages

import java.lang.Class
import kotlin.Any
import kotlin.Boolean
import kotlin.String
import kotlin.Unit
import org.apache.camel.kotlin.CamelDslMarker
import org.apache.camel.model.language.MethodCallExpression

public fun bean(bean: String, i: BeanLanguageDsl.() -> Unit = {}): MethodCallExpression {
val def = MethodCallExpression(bean)
BeanLanguageDsl(def).apply(i)
return def
}

@CamelDslMarker
public class BeanLanguageDsl(
def: MethodCallExpression,
) {
public val def: MethodCallExpression

init {
this.def = def
}

public fun id(id: String) {
def.id = id
}

public fun ref(ref: String) {
def.ref = ref
}

public fun method(method: String) {
def.method = method
}

public fun beanType(beanType: Class<out Any>) {
def.beanType = beanType
}

public fun scope(scope: String) {
def.scope = scope
}

public fun validate(validate: Boolean) {
def.validate = validate.toString()
}

public fun validate(validate: String) {
def.validate = validate
}

public fun resultType(resultType: Class<out Any>) {
def.resultType = resultType
}

public fun trim(trim: Boolean) {
def.trim = trim.toString()
}

public fun trim(trim: String) {
def.trim = trim
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.camel.kotlin.languages

import java.lang.Class
import kotlin.Any
import kotlin.Boolean
import kotlin.String
import kotlin.Unit
import org.apache.camel.kotlin.CamelDslMarker
import org.apache.camel.model.language.ConstantExpression

public fun constant(constant: String, i: ConstantLanguageDsl.() -> Unit = {}): ConstantExpression {
val def = ConstantExpression(constant)
ConstantLanguageDsl(def).apply(i)
return def
}

@CamelDslMarker
public class ConstantLanguageDsl(
def: ConstantExpression,
) {
public val def: ConstantExpression

init {
this.def = def
}

public fun id(id: String) {
def.id = id
}

public fun resultType(resultType: Class<out Any>) {
def.resultType = resultType
}

public fun trim(trim: Boolean) {
def.trim = trim.toString()
}

public fun trim(trim: String) {
def.trim = trim
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.camel.kotlin.languages

import java.lang.Class
import kotlin.Any
import kotlin.Boolean
import kotlin.String
import kotlin.Unit
import org.apache.camel.kotlin.CamelDslMarker
import org.apache.camel.model.language.CSimpleExpression

public fun csimple(csimple: String, i: CsimpleLanguageDsl.() -> Unit = {}): CSimpleExpression {
val def = CSimpleExpression(csimple)
CsimpleLanguageDsl(def).apply(i)
return def
}

@CamelDslMarker
public class CsimpleLanguageDsl(
def: CSimpleExpression,
) {
public val def: CSimpleExpression

init {
this.def = def
}

public fun id(id: String) {
def.id = id
}

public fun resultType(resultType: Class<out Any>) {
def.resultType = resultType
}

public fun trim(trim: Boolean) {
def.trim = trim.toString()
}

public fun trim(trim: String) {
def.trim = trim
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.camel.kotlin.languages

import java.lang.Class
import kotlin.Any
import kotlin.Boolean
import kotlin.String
import kotlin.Unit
import org.apache.camel.kotlin.CamelDslMarker
import org.apache.camel.model.language.DatasonnetExpression

public fun datasonnet(datasonnet: String, i: DatasonnetLanguageDsl.() -> Unit = {}):
DatasonnetExpression {
val def = DatasonnetExpression(datasonnet)
DatasonnetLanguageDsl(def).apply(i)
return def
}

@CamelDslMarker
public class DatasonnetLanguageDsl(
def: DatasonnetExpression,
) {
public val def: DatasonnetExpression

init {
this.def = def
}

public fun id(id: String) {
def.id = id
}

public fun bodyMediaType(bodyMediaType: String) {
def.bodyMediaType = bodyMediaType
}

public fun outputMediaType(outputMediaType: String) {
def.outputMediaType = outputMediaType
}

public fun variableName(variableName: String) {
def.variableName = variableName
}

public fun headerName(headerName: String) {
def.headerName = headerName
}

public fun propertyName(propertyName: String) {
def.propertyName = propertyName
}

public fun resultType(resultType: Class<out Any>) {
def.resultType = resultType
}

public fun trim(trim: Boolean) {
def.trim = trim.toString()
}

public fun trim(trim: String) {
def.trim = trim
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.camel.kotlin.languages

import kotlin.Boolean
import kotlin.String
import kotlin.Unit
import org.apache.camel.kotlin.CamelDslMarker
import org.apache.camel.model.language.ExchangePropertyExpression

public fun exchangeProperty(exchangeProperty: String, i: ExchangepropertyLanguageDsl.() -> Unit =
{}): ExchangePropertyExpression {
val def = ExchangePropertyExpression(exchangeProperty)
ExchangepropertyLanguageDsl(def).apply(i)
return def
}

@CamelDslMarker
public class ExchangepropertyLanguageDsl(
def: ExchangePropertyExpression,
) {
public val def: ExchangePropertyExpression

init {
this.def = def
}

public fun id(id: String) {
def.id = id
}

public fun trim(trim: Boolean) {
def.trim = trim.toString()
}

public fun trim(trim: String) {
def.trim = trim
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.camel.kotlin.languages

import java.lang.Class
import kotlin.Any
import kotlin.Boolean
import kotlin.String
import kotlin.Unit
import org.apache.camel.kotlin.CamelDslMarker
import org.apache.camel.model.language.SimpleExpression

public fun `file`(`file`: String, i: FileLanguageDsl.() -> Unit = {}): SimpleExpression {
val def = SimpleExpression(file)
FileLanguageDsl(def).apply(i)
return def
}

@CamelDslMarker
public class FileLanguageDsl(
def: SimpleExpression,
) {
public val def: SimpleExpression

init {
this.def = def
}

public fun id(id: String) {
def.id = id
}

public fun resultType(resultType: Class<out Any>) {
def.resultType = resultType
}

public fun trim(trim: Boolean) {
def.trim = trim.toString()
}

public fun trim(trim: String) {
def.trim = trim
}
}
Loading

0 comments on commit 6b273d0

Please sign in to comment.