简体   繁体   中英

Usage guide of treemap from the code

public class MMTUtil
{
private static Map<String, String> domainDocumentationMap             = null;
 static
    {
     domainDocumentationMap = new TreeMap<String, String>();
    }

public static Map<String, String> getDomainDocumentationMap() {
    return domainDocumentationMap;
}

public static void setDomainDocumentationMap(Map<String, String> domainDocumentationMap) {
    MMTUtil.domainDocumentationMap = domainDocumentationMap;
}

Can you guys help me understand this code ?

How can I use this code to return me domainComboDocumentationMap and domainComboDocumentationMap so that I can use it in another java file ?

Edit:



public UMRResultObject insertDocumentation(UMRDocumentationDTO documentationDTO)
{
    Session     session = UMRHibernateUtil.getUmrSession();
    Transaction tx      = null;
    documentationLink = null;
    objectName = null;
    objectType = null;

    try
    {
        tx = session.beginTransaction();
        dao.insertDocumentation(documentationDTO, session);
********MMTUtil.getDomainDocumentationMap().put(objectName.getDomainName()+objectType.getDomainType(),documentationLink.getDocumentationLink());******
        tx.commit();
        ro.setSuccess(true);
        ro.getMessages().add("Record Inserted Successfully");
    }

MMTUtil is a class with static methods, so you can just use it like this:

MMTUtil.getDomainComboDocumentationMap() will return a domainComboDocumentationMap MMTUtil.getDomainDocumentationMap() will return a domainDocumentationMap

You will need to import MMTUtil into the other java file that is using this class.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM