Skip to content

Make an instance of a class that is not in Project Files like in internet or in another folder from a URL object or a File object.

License

Notifications You must be signed in to change notification settings

paulzondaf/instance-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

instance-helper

Make an instance of a class who are not in Project Files like in internet or in another folder.

How To:

Make an instance of a class from a java.net.URL object or a java.io.File object.

Examples:

User Class:

public class User {

    private String name;
    private int age;

    public User(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}

Main Class:

import java.io.File;

public class Main {

    public static void main(String[] args) {
        final Object obj = newInstance(new File("C://Users/Papa/Desktop/"), "User", new Class[]{
                String.class, int.class
        }, "Paul", 15);
    }
}

About

Make an instance of a class that is not in Project Files like in internet or in another folder from a URL object or a File object.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages