本文整理汇总了Java中org.apache.tools.ant.BuildEvent.getTarget方法的典型用法代码示例。如果您正苦于以下问题:Java BuildEvent.getTarget方法的具体用法?Java BuildEvent.getTarget怎么用?Java BuildEvent.getTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tools.ant.BuildEvent
的用法示例。
在下文中一共展示了BuildEvent.getTarget方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: messageLogged
import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
/**
* @see BuildListener#messageLogged
* {@inheritDoc}.
*/
@Override
public void messageLogged(final BuildEvent event) {
Object categoryObject = event.getTask();
if (categoryObject == null) {
categoryObject = event.getTarget();
if (categoryObject == null) {
categoryObject = event.getProject();
}
}
final Logger log
= Logger.getLogger(categoryObject.getClass().getName());
switch (event.getPriority()) {
case Project.MSG_ERR:
log.error(event.getMessage());
break;
case Project.MSG_WARN:
log.warn(event.getMessage());
break;
case Project.MSG_INFO:
log.info(event.getMessage());
break;
case Project.MSG_VERBOSE:
log.debug(event.getMessage());
break;
case Project.MSG_DEBUG:
log.debug(event.getMessage());
break;
default:
log.error(event.getMessage());
break;
}
}
示例2: messageLogged
import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
/**
* @see BuildListener#messageLogged
* {@inheritDoc}.
*/
@Override
public void messageLogged(final BuildEvent event) {
if (initialized) {
Object categoryObject = event.getTask();
String categoryString;
String categoryDetail = null;
if (categoryObject == null) {
categoryObject = event.getTarget();
if (categoryObject == null) {
categoryString = PROJECT_LOG;
categoryDetail = event.getProject().getName();
} else {
categoryString = TARGET_LOG;
categoryDetail = event.getTarget().getName();
}
} else {
// It's a task - append the target
if (event.getTarget() != null) {
categoryString = categoryObject.getClass().getName();
categoryDetail = event.getTarget().getName();
} else {
categoryString = categoryObject.getClass().getName();
}
}
final Log log = getLog(categoryString, categoryDetail);
final int priority = event.getPriority();
final String message = event.getMessage();
realLog(log, message, priority, null);
}
}
示例3: targetStarted
import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
public void targetStarted(BuildEvent event) {
currentTarget = event.getTarget();
Target target = event.getTarget();
if (debugtargets.contains(target.getName())) {
prompt.prompt("Break Point at Target: " + target.getName());
}
}