本文整理汇总了Java中ch.qos.logback.core.joran.spi.InterpretationContext.peekObject方法的典型用法代码示例。如果您正苦于以下问题:Java InterpretationContext.peekObject方法的具体用法?Java InterpretationContext.peekObject怎么用?Java InterpretationContext.peekObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ch.qos.logback.core.joran.spi.InterpretationContext
的用法示例。
在下文中一共展示了InterpretationContext.peekObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: end
import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
@Override
public void end(InterpretationContext ic, String name) throws ActionException {
if(!weAreActive(ic)) return;
ThenActionState state = stateStack.pop();
if (state.isRegistered) {
ic.removeInPlayListener(state);
Object o = ic.peekObject();
if (o instanceof IfAction) {
IfAction ifAction = (IfAction) o;
removeFirstAndLastFromList(state.eventList);
registerEventList(ifAction, state.eventList);
} else {
throw new IllegalStateException("Missing IfAction on top of stack");
}
}
}
示例2: end
import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
/**
* Once the children elements are also parsed, now is the time to activate the
* shutdown hook options.
*/
@Override
public void end(InterpretationContext ic, String name) throws ActionException {
if (inError) {
return;
}
Object o = ic.peekObject();
if (o != hook) {
addWarn("The object at the of the stack is not the hook pushed earlier.");
} else {
ic.popObject();
Thread hookThread = new Thread(hook, "Logback shutdown hook [" + context.getName() + "]");
context.putObject(CoreConstants.SHUTDOWN_HOOK_THREAD, hookThread);
Runtime.getRuntime().addShutdownHook(hookThread);
}
}
示例3: end
import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
/**
* Now property definer is initialized by all properties and we can put
* property value to context
*/
public void end(InterpretationContext ec, String name) {
if (inError) {
return;
}
Object o = ec.peekObject();
if (o != definer) {
addWarn("The object at the of the stack is not the property definer for property named ["
+ propertyName + "] pushed earlier.");
} else {
addInfo("Popping property definer for property named [" + propertyName
+ "] from the object stack");
ec.popObject();
// let's put defined property and value to context but only if it is
// not null
String propertyValue = definer.getPropertyValue();
if(propertyValue != null) {
ActionUtil.setProperty(ec, propertyName, propertyValue, scope);
}
}
}
示例4: end
import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
/**
* Once the children elements are also parsed, now is the time to activate the
* appender options.
*/
public void end(InterpretationContext ec, String name) {
if (inError) {
return;
}
if (appender instanceof LifeCycle) {
((LifeCycle) appender).start();
}
Object o = ec.peekObject();
if (o != appender) {
addWarn("The object at the of the stack is not the appender named ["
+ appender.getName() + "] pushed earlier.");
} else {
ec.popObject();
}
}
示例5: end
import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
@Override
public void end(InterpretationContext ic, String name)
throws ActionException {
if (inError) return;
ic.getContext().register(receiver);
receiver.start();
Object o = ic.peekObject();
if (o != receiver) {
addWarn("The object at the of the stack is not the remote " +
"pushed earlier.");
} else {
ic.popObject();
}
}
示例6: end
import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
@Override
public void end(InterpretationContext ec, String name) throws ActionException {
if (inError) {
return;
}
Object o = ec.peekObject();
if (o != lcl) {
addWarn("The object on the top the of the stack is not the LoggerContextListener pushed earlier.");
} else {
if (lcl instanceof LifeCycle) {
((LifeCycle) lcl).start();
addInfo("Starting LoggerContextListener");
}
((LoggerContext) context).addListener(lcl);
ec.popObject();
}
}
示例7: verifyAndPop
import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
private void verifyAndPop(InterpretationContext ic) {
Object o = ic.peekObject();
Assert.state(o != null, "Unexpected null object on stack");
Assert.isInstanceOf(SpringProfileAction.class, o, "logback stack error");
Assert.state(o == this, "ProfileAction different than current one on stack");
ic.popObject();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:SpringProfileAction.java
示例8: end
import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
public void end(InterpretationContext ec, String name) {
// pop nameStr value from the special stack
String nameStr = (String) nameStrStack.pop();
if (OptionHelper.isEmpty(nameStr)) {
// nothing to do
} else {
Integer i = (Integer) ec.peekObject();
System.out.println(
"The computation named [" + nameStr + "] resulted in the value " + i);
}
}
示例9: end
import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
/**
* Once the children elements are also parsed, now is the time to activate the
* evaluator options.
*/
@SuppressWarnings("unchecked")
public void end(InterpretationContext ec, String e) {
if (inError) {
return;
}
if (evaluator instanceof LifeCycle) {
((LifeCycle) evaluator).start();
addInfo("Starting evaluator named [" + evaluator.getName() + "]");
}
Object o = ec.peekObject();
if (o != evaluator) {
addWarn("The object on the top the of the stack is not the evaluator pushed earlier.");
} else {
ec.popObject();
try {
Map<String, EventEvaluator<?>> evaluatorMap = (Map<String, EventEvaluator<?>>) context
.getObject(CoreConstants.EVALUATOR_MAP);
if(evaluatorMap == null) {
addError("Could not find EvaluatorMap");
} else {
evaluatorMap.put(evaluator.getName(), evaluator);
}
} catch (Exception ex) {
addError("Could not set evaluator named [" + evaluator + "].", ex);
}
}
}
示例10: begin
import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
public void begin(
InterpretationContext ec, String localName, Attributes attributes) {
String name = attributes.getValue(NAME_ATTRIBUTE);
String value = attributes.getValue(VALUE_ATTRIBUTE);
if (name == null) {
inError = true;
addError(NO_NAME);
return;
}
if (value == null) {
inError = true;
addError(NO_VALUE);
return;
}
// remove both leading and trailing spaces
value = value.trim();
Object o = ec.peekObject();
PropertySetter propSetter = new PropertySetter(o);
propSetter.setContext(context);
value = ec.subst(value);
// allow for variable substitution for name as well
name = ec.subst(name);
//getLogger().debug(
// "In ParamAction setting parameter [{}] to value [{}].", name, value);
propSetter.setProperty(name, value);
}
示例11: isApplicable
import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
public boolean isApplicable(ElementPath elementPath, Attributes attributes,
InterpretationContext ic) {
String nestedElementTagName = elementPath.peekLast();
// calling ic.peekObject with an empty stack will throw an exception
if (ic.isEmpty()) {
return false;
}
Object o = ic.peekObject();
PropertySetter parentBean = new PropertySetter(o);
parentBean.setContext(context);
AggregationType aggregationType = parentBean
.computeAggregationType(nestedElementTagName);
switch (aggregationType) {
case NOT_FOUND:
case AS_BASIC_PROPERTY:
case AS_BASIC_PROPERTY_COLLECTION:
return false;
// we only push action data if NestComponentIA is applicable
case AS_COMPLEX_PROPERTY_COLLECTION:
case AS_COMPLEX_PROPERTY:
IADataForComplexProperty ad = new IADataForComplexProperty(parentBean,
aggregationType, nestedElementTagName);
actionDataStack.push(ad);
return true;
default:
addError("PropertySetter.computeAggregationType returned "
+ aggregationType);
return false;
}
}
示例12: end
import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
public void end(InterpretationContext ec, String e) {
if (inError) {
return;
}
if (statusListener instanceof LifeCycle) {
((LifeCycle) statusListener).start();
}
Object o = ec.peekObject();
if (o != statusListener) {
addWarn("The object at the of the stack is not the statusListener pushed earlier.");
} else {
ec.popObject();
}
}
示例13: isApplicable
import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
public boolean isApplicable(ElementPath elementPath, Attributes attributes,
InterpretationContext ec) {
// System.out.println("in NestedSimplePropertyIA.isApplicable [" + pattern +
// "]");
String nestedElementTagName = elementPath.peekLast();
// no point in attempting if there is no parent object
if (ec.isEmpty()) {
return false;
}
Object o = ec.peekObject();
PropertySetter parentBean = new PropertySetter(o);
parentBean.setContext(context);
AggregationType aggregationType = parentBean
.computeAggregationType(nestedElementTagName);
switch (aggregationType) {
case NOT_FOUND:
case AS_COMPLEX_PROPERTY:
case AS_COMPLEX_PROPERTY_COLLECTION:
return false;
case AS_BASIC_PROPERTY:
case AS_BASIC_PROPERTY_COLLECTION:
IADataForBasicProperty ad = new IADataForBasicProperty(parentBean,
aggregationType, nestedElementTagName);
actionDataStack.push(ad);
// addInfo("NestedSimplePropertyIA deemed applicable [" + pattern + "]");
return true;
default:
addError("PropertySetter.canContainComponent returned " + aggregationType);
return false;
}
}
示例14: end
import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
@Override
public void end(InterpretationContext ic, String name) throws ActionException {
ic.removeInPlayListener(this);
Object o = ic.peekObject();
if (o instanceof SiftingAppender) {
SiftingAppender sa = (SiftingAppender) o;
Map<String, String> propertyMap = ic.getCopyOfPropertyMap();
AppenderFactoryUsingJoran appenderFactory = new AppenderFactoryUsingJoran(seList, sa
.getDiscriminatorKey(), propertyMap);
sa.setAppenderFactory(appenderFactory);
}
}
示例15: end
import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
/**
* Children elements have been processed. The sesults should be an integer
* placed at the top of the execution stack.
*
* This value will be printed on the console but only if the action is
* named. Anonymous computation will not print their result.
*/
public void end(InterpretationContext ec, String name) {
if (OptionHelper.isEmpty(nameStr)) {
// nothing to do
} else {
Integer i = (Integer) ec.peekObject();
System.out.println(
"The computation named [" + nameStr + "] resulted in the value " + i);
}
}