📄 jjacketjacsonstate.java
字号:
package com.jhkdesign.console.cmd;
import java.util.Set;
import com.jhkdesign.console.ArgumentInt;
import com.jhkdesign.console.EnvironmentInt;
import de.spieleck.app.jacson.JacsonState;
/**
* Wrap the JJacket ArgumentInt to an JacsonState,
* so that the JacsonTask can read/write the JJacket Environment.
*
* @author fsn
*/
public class JJacketJacsonState
extends JacsonState
{
protected EnvironmentInt env;
/**
* Create it.
*/
public JJacketJacsonState(ArgumentInt arg)
{
super();
env = arg.getEnvironment();
}
public Object getContextual(String key)
{
if ( attributes != null && attributes.containsKey(key) )
{
return attributes.get(key);
}
else if ( getParent() != null )
{
return getParent().get(key);
}
return getGlobal(key);
}
public Object getGlobal(String key)
{
return env.get(key);
}
public void putContext(String key, Object value)
{
putLocal(key, value);
}
public Set getLocalKeySet()
{
Set set = super.getLocalKeySet();
String[] names = env.getAllNames();
if ( names != null )
for(int i = 0; i < names.length; i++ )
set.add(names[i]);
return set;
}
public void putGlobal(String key, Object value)
{
env.set(key, value.toString());
}
protected JacsonState getRoot()
{
return this;
}
protected JacsonState getParent()
{
return null;
}
}
//
// Jacson - Text Filtering with Java.
// Copyright (C) 2002 Frank S. Nestel (nestefan -at- users.sourceforge.net)
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -