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

  • Home
  • SEARCH
  • 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 8628829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:39:13+00:00 2026-06-12T08:39:13+00:00

Here is the scenario: I have: public class RandomStringUUID { public RandomStringUUID() { final

  • 0

Here is the scenario:
I have:

public class RandomStringUUID {

    public RandomStringUUID() {
        final String uuidstring = UUID.randomUUID().toString().replaceAll("-", "");
    }


    public String getRandomStringUUID() {
        final String uuidst = UUID.randomUUID().toString().replaceAll("-", "");
        return uuidst;
    }
}

Where i am generating a Unique Value.

Then in :

public class AddSingleDomain {

    public static RandomStringUUID RUUID = new RandomStringUUID();

    @Test
    public void addSingleDomain() {
        AssertJUnit.assertEquals(DomainsPage.getTitle(), "View Account");


        String randomUIDSeed = RUUID.getRandomStringUUID();

        System.out.println("Random Domanin Name Prefix: "
                + randomUIDSeed);
        System.out.println("Random Domanin Name Prefix: " + RUUID);


        getDriver().findElement(By.name("vo.zoneName")).sendKeys(
                randomUIDSeed + ".tv");

I use it, and then, yet in another class:

public class VerifyDBSingleDomain {

String url = "jdbc:oracle:thin:@a.b.c.d:1521:ms";

@Test
public void VerifyDBSingleDomainTest()  {

    Properties props = new Properties();
    props.setProperty("user", "user");
    props.setProperty("password", "pass");


String sql = "Select zoneid from zone where zonename =" +  randomUIDSeed + ".tv";

I want to use the SAME VALUE “randomUIDSeed”
If in class VerifyDBSingleDomain i : String randomUIDSeed = RUUID.getRandomStringUUID();
would it be the same object ? How can i use this as same object, and hence guranteeing the same value across ALL classes during runtime.

  • 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-12T08:39:14+00:00Added an answer on June 12, 2026 at 8:39 am

    You could start by making this little change:

    public class RandomStringUUID {
    
        private static final String MYUUID = UUID.randomUUID().toString().replaceAll("-", "");
    
        public static String getRandomStringUUID() { return MYUUID; }
    }
    

    You can then use it like this:

    // Anywhere in your code: vv Note that we are using the classname! The method is static.
    String theCommonID = RandomStringUUID.getRandomStringUUID();
    

    This is just a hint into the direction. This is not a “perfect” clean solution. You might want to google “Singleton Design Pattern”. And I can imagine ~10 other ways to do this right now … But anyway.

    This will create one of your IDs once for the runtime of your app.

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

Sidebar

Related Questions

I have scenario like Here is the abstract class abstract class A { public
Here's the scenario: I have a public repo A . Bob forks A ,
I have a similar scenario as this one: public class TestLinq2Xml { private XElement
The scenario Suppose I have the following two model classes: public class ProductColor {
I have a classic Order -> Order Row scenario something like this: public class
This is my scenario. I have internal class with a standard int property. public
Here Scenario is HttpContext.Current.Session[value].ToString() gives null value, even have already set session value when
Here is my scenario: I have two MySQL tables: Categories (columns: id, category) Items
Here is my scenario: I have an Eclipse project in my desktop in a
Here is the scenario: I have a visual that displays some data The data

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.