locatableconstantfactory.java

来自「在Struts2中的jar包xwork的源代码.版本为2.0.7」· Java 代码 · 共 33 行

JAVA
33
字号
/** *  */package com.opensymphony.xwork2.config.impl;import com.opensymphony.xwork2.inject.Context;import com.opensymphony.xwork2.inject.Factory;import com.opensymphony.xwork2.util.location.Located;import com.opensymphony.xwork2.util.location.LocationUtils;/** * Factory that remembers where a constant came from */public class LocatableConstantFactory<T> extends Located implements Factory {    T constant;    public LocatableConstantFactory(T constant, Object location) {        this.constant = constant;        setLocation(LocationUtils.getLocation(location));    }        public T create(Context ignored) {        return constant;    }        public String toString() {        StringBuilder sb = new StringBuilder();        sb.append(super.toString());        sb.append(" defined at ");        sb.append(getLocation().toString());        return sb.toString();    }}

⌨️ 快捷键说明

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