本文整理汇总了Java中com.google.inject.spi.Message.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java Message.getMessage方法的具体用法?Java Message.getMessage怎么用?Java Message.getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.inject.spi.Message
的用法示例。
在下文中一共展示了Message.getMessage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mergeSources
import com.google.inject.spi.Message; //导入方法依赖的package包/类
/** Prepends the list of sources to the given {@link Message} */
static Message mergeSources(List<Object> sources, Message message) {
List<Object> messageSources = message.getSources();
// It is possible that the end of getSources() and the beginning of message.getSources() are
// equivalent, in this case we should drop the repeated source when joining the lists. The
// most likely scenario where this would happen is when a scoped binding throws an exception,
// due to the fact that InternalFactoryToProviderAdapter applies the binding source when
// merging errors.
if (!sources.isEmpty()
&& !messageSources.isEmpty()
&& Objects.equal(messageSources.get(0), sources.get(sources.size() - 1))) {
messageSources = messageSources.subList(1, messageSources.size());
}
return new Message(
ImmutableList.builder().addAll(sources).addAll(messageSources).build(),
message.getMessage(),
message.getCause());
}
示例2: addErrorAndThrow
import com.google.inject.spi.Message; //导入方法依赖的package包/类
private void addErrorAndThrow(Field field, String format, Object... args) {
Preconditions.checkNotNull(binder);
String source = String.format(
"%s field %s",
field.getDeclaringClass().getName(),
field.getName());
Message messageObj = new Message(source, String.format(format, args));
binder.addError(messageObj);
throw new BoundFieldException(messageObj.getMessage());
}
示例3: merge
import com.google.inject.spi.Message; //导入方法依赖的package包/类
private Message merge(Message message) {
List<Object> sources = Lists.newArrayList();
sources.addAll(getSources());
sources.addAll(message.getSources());
return new Message(sources, message.getMessage(), message.getCause());
}
示例4: BoundFieldException
import com.google.inject.spi.Message; //导入方法依赖的package包/类
BoundFieldException(Message message) {
super(message.getMessage());
this.message = message;
}
示例5: merge
import com.google.inject.spi.Message; //导入方法依赖的package包/类
private Message merge(Message message) {
List<Object> sources = Lists.newArrayList();
sources.addAll(getSources());
sources.addAll(message.getSources());
return new Message(sources, message.getMessage(), message.getCause());
}