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 6635313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:02:17+00:00 2026-05-25T23:02:17+00:00

I have an java interface public interface IPerson { Person addPerson(String name ); Person

  • 0

I have an java interface

    public interface IPerson {
      Person  addPerson(String name );
      Person  addPerson(String name1,String name2);
      Person  addPerson(String name,String[] details);
      Person  addPerson(String name,String name1,String[] details);
      Person  addPerson(String name,List<String> details);
    }

With PersonImpl .java being:

class PersonImpl implemets Iperson {
       ..
  // and interface methods implemtation

}

and my person.java looks like

class Person {
    def firstName;
    def lastName;
}

And my PersonTest.groovy looks like

def PersonImpl   person  = new PersonImpl();

person.addPerson("anish")
person.addPerson("anish","nath")
person.addPerson("john","smith")
person.addPerson("tim","yates")
def list=[];
list.add("abc")
list.add("qpr")
person.addPerson("anish",list)
person.addPerson("nath","11", [".docsDevNmAccessStatus.1", "Integer", "4"])
person.addPerson("nath","11", [".docsDevNmAccessStatus.1", "String", "4"])

Is there any way to define the DSL for this interface so that i easily called addOperation easily?

The problem is that the IPerson interface cannot be changed.

how can i write dsl something like

addPerson "anihs" "nath" //call to person.addPerson("anish","nath")
addPerson "tim" "kates" 

//simlary of other interface method any suggestion
  • 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-05-25T23:02:18+00:00Added an answer on May 25, 2026 at 11:02 pm

    In Groovy something like addPerson "anihs" "nath" is not really allowed. If you wanted two arguments you would have to use a comma. So the best you can get is addPerson "anihs", "nath". But this method calls is just hanging in the air, the context is missing. One quite easy version would be of course:

    def PersonImpl person = new PersonImpl();
    person.with {
      addPerson "anish"
      addPerson "anish","nath"
      addPerson "john","smith"
      addPerson "tim","yates"
      def list = ["abc", "qpr"]
      addPerson "anish",list
      addPerson "nath","11", [".docsDevNmAccessStatus.1", "Integer", "4"]
      addPerson "nath","11", [".docsDevNmAccessStatus.1", "String", "4"]
    }
    

    though I am not sure this is enough for you.

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

Sidebar

Related Questions

Suppose I have a Java inteface public interface Bar { public void baz(String st)
I have three files: ScriptProcessor.java: public interface ScriptProcessor { public String someMethod(); } ScriptProcessorDummy.java:
Let's say I have the following Java interface that I may not modify: public
I have an Java-Annotation that return a double value: @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface DoubleValue
I have a problem in Java: I have an interface: public interface I extends
I have an java interface which has few abstract methods. public interface Interface {
In Java, if I have an interface: public interface MyInterface{ } Then MyInterface implementation
I have a Java interface in an API that contains a single method: public
I have the following Java interfaces, public interface JavascriptInterface { public MyIterator getItems(); }
I have the following interface in Java public interface IFoo { public abstract void

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.