⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usermanagerproviderbean.java

📁 java 写的一个新闻发布系统
💻 JAVA
字号:
package org.jahia.services.usermanager;import java.lang.reflect.InvocationTargetException;import java.lang.reflect.Method;/** * <p>Title: Small bean to manage provider info </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2002</p> * <p>Company: Jahia Inc.</p> * * @author Serge Huber * @version 3.0 */public class UserManagerProviderBean {    private String key;    private String className;    private String description;    private String title;    private boolean isReadOnly = true;    private JahiaUserManagerProvider instance;    private boolean isDefault = false;    private int priority = 99;    public UserManagerProviderBean ( String key,                                     String className,                                     String title,                                     String description,                                     boolean isDefault,                                    boolean isReadOnly,                                    int priority) {        this.key = key;        this.className = className;        this.description = description;        this.title = title;        this.isDefault = isDefault;        this.isReadOnly = isReadOnly;        this.priority = priority;    }    public String getKey() {        return key;    }    public void setKey(String key) {        this.key = key;    }    public void setClassName(String className) {        this.className = className;    }    public String getClassName() {        return className;    }    public void setDescription(String description) {        this.description = description;    }    public String getDescription() {        return description;    }    public void setTitle(String title) {        this.title = title;    }    public String getTitle() {        return title;    }    public void setIsDefault(boolean isDefault) {        this.isDefault = isDefault;    }    public boolean getIsDefault() {        return isDefault;    }    public void setIsReadOnly(boolean isReadOnly) {        this.isReadOnly = isReadOnly;    }    public boolean getIsReadOnly() {        return isReadOnly;    }    public void setPriority (int priority) {        this.priority = priority;    }    public int getPriority () {        return priority;    }    public JahiaUserManagerProvider getInstance() {        if (this.instance != null) {            return this.instance;        }        if (this.className == null) {            return null;        }        try {            Class destClass = Class.forName(this.className);            Class superClass = destClass.getSuperclass();            if (superClass == null) {                return null;            }            if (!"org.jahia.services.usermanager.JahiaUserManagerProvider".equals (                    superClass.getName ())) {                // class parent is not of correct type.                return null;            }            Method getInstanceMethod = destClass.getMethod("getInstance", null);            if (getInstanceMethod == null) {                return null;            }            this.instance = (JahiaUserManagerProvider) getInstanceMethod.invoke(null, null);        } catch (LinkageError le) {            le.printStackTrace();            this.instance = null;        } catch (ClassNotFoundException cnfe) {            cnfe.printStackTrace();            this.instance = null;        } catch (NoSuchMethodException nsme) {            nsme.printStackTrace();            this.instance = null;        } catch (InvocationTargetException ite) {            ite.printStackTrace();            this.instance = null;        } catch (IllegalAccessException iae) {            iae.printStackTrace();            this.instance = null;        }        return this.instance;    }    public boolean equals (Object obj) {        if (!(obj instanceof UserManagerProviderBean)) {            return false;        }        UserManagerProviderBean right = (UserManagerProviderBean) obj;        return objectEquals (getKey (), right.getKey ());    }    private boolean objectEquals (String left, String right) {        if ((left == null) && (right == null)) {            return true;        } else if ((left == null) && (right != null)) {            return false;        } else if ((left != null) && (right == null)) {            return false;        } else {            // we are now guaranteed that neither left or right are null so we            // can call the equals method safely.            return left.equals (right);        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -