Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8957697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:03:05+00:00 2026-06-15T15:03:05+00:00

I am trying to expose a expression engine built on top of groovy for

  • 0

I am trying to expose a expression engine built on top of groovy for end users. I have some excel style keywords and user can use variables within those keywords (which need to be substituted at runtime) for evaluation.
example, static keyword FIRSTCHAR(varName) will return the first character of a string. I have got this to work in a way.

Current Implementation
I have overridden the groovy class loader to create a compilation unit with an overridden PrimaryClassNodeOperation something like

class MyGroovyClassLoader extends GroovyClassLoader {
    protected CompilationUnit createCompilationUnit(
            CompilerConfiguration config, CodeSource source) {
        CompilationUnit cu = super.createCompilationUnit(config, source);
        cu.addPhaseOperation(new PrimaryClassNodeOperation(){

            @Override
            public void call(SourceUnit source, GeneratorContext context, ClassNode classNode)
                    throws CompilationFailedException {
               source.getAST().getStatementBlock().visit(visitor);
            }
        }, Phases.SEMANTIC_ANALYSIS);
        return cu;
    }
}

The visitor then recognizes the static expression and variable expression. However, using this approach I am having difficulties in

1) Supporting variable names with dot (.) since dot is considered a property expression. Can I during this phase keep the property expression as variable expression.

2) Also, for an expression like (left(name,1)==’S’ && right(name,1)==’n’) [first character in name is s and last is n] – I want the equal to check to be single equals rather than double equals, and/AND instead of && or .and() so something like (left(name,1)=’S’ and right(name,1)=’n’)

What’s the best way to achieve such customizations?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:03:05+00:00Added an answer on June 15, 2026 at 3:03 pm

    The best approach would be to use a custom parser (since you dont want your users to write any groovy) and then use groovy to actually implement the back-end

    eg: Very indicative, your implementation can vary

    (left(name,1)='S')
    

    For the snipet above, tokens could be method:left, args:((var:name),(val:1)), exp:EQUALS, val:’S’
    Have a map at the back which equates your tokens to groovy equivalents

    You could then be fire your parsed tokens against a groovy class, of course the methods and arguments dont exist, use some groovy tricks to translate it to your actual implementation 1

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to expose some data, user names, as json format on my
I trying to expose some groovy service with jersey and girzzly. but i got
I'm trying to learn some C#.net. I'm just trying to expose the AdventureWorks database
I'm trying to write a web app that needs to expose some methods that
I am trying to expose some Java web services so that I can interoperate
I'm trying to expose some events from a private object which is contained inside
I am trying to expose C++ container to Python. I have: class Container {
I'm trying to expose methods using my subclass of Binder. I'm gonna have my
I have a resource in which I'm trying to expose its' votes. class ViewPostResource(ModelResource):
I'm trying to expose a search feature in rails. I want a user to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.