当前位置: 首页>>代码示例>>Java>>正文


Java StringUtil.format方法代码示例

本文整理汇总了Java中org.febit.util.StringUtil.format方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtil.format方法的具体用法?Java StringUtil.format怎么用?Java StringUtil.format使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.febit.util.StringUtil的用法示例。


在下文中一共展示了StringUtil.format方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleFailedFindResponse

import org.febit.util.StringUtil; //导入方法依赖的package包/类
protected <T extends Entity> T handleFailedFindResponse(LcFindResponse<T> response, String id) {
    if (response.getStatusCode() == 404
            && response.getCode() == 101) {
        return null;
    }
    throw new LcException(StringUtil.format(
            "Failed to query table: {}, response {}, where id={}",
            _table, response, id
    ));
}
 
开发者ID:febit,项目名称:febit,代码行数:11,代码来源:LcService.java

示例2: handleFailedQueryResponse

import org.febit.util.StringUtil; //导入方法依赖的package包/类
protected <T extends Entity> List<T> handleFailedQueryResponse(LcQueryResponse<T> response, LcQuery query) {
    if (response.getStatusCode() == 404
            && response.getCode() == 101) {
        return Collections.EMPTY_LIST;
    }
    throw new LcException(StringUtil.format(
            "Failed to query table: {}, response {}, where {}",
            _table, response, JsonUtil.toJsonString(query)
    ));
}
 
开发者ID:febit,项目名称:febit,代码行数:11,代码来源:LcService.java

示例3: addEntry

import org.febit.util.StringUtil; //导入方法依赖的package包/类
protected void addEntry(long from, long to, int country, int isp, int province, int city) {
    if (from > to) {
        throw new RuntimeException(StringUtil.format("from > to : {} > {} ", from, to));
    }
    if (this.last + 1 != from) {
        if (this.last + 1 < from) {
            //fix lost part
            LOG.debug("Fix lost part: {} - {}" + from, (this.last + 1), from);
            addEntry(this.last + 1, from - 1, 0, 0, 0, 0);
        } else {
            throw new RuntimeException(StringUtil.format("Not increated, except {}, but got {}", this.last + 1, from));
        }
    }

    final int toSegment = resolveSegment(to);
    final int toLIP = resolveLitteIP(to);

    int startSegment = resolveSegment(from);
    while (startSegment < toSegment) {
        //填满跨越的段
        LOG.debug("Fill segment: {}", startSegment);
        push(new Entry(startSegment, IP_PART_MAX, country, isp, province, city));
        startSegment++;
    }
    push(new Entry(toSegment, toLIP, country, isp, province, city));

    //END
    this.last = to;
}
 
开发者ID:febit,项目名称:febit,代码行数:30,代码来源:Transfer.java

示例4: get

import org.febit.util.StringUtil; //导入方法依赖的package包/类
public static Object get(final Object bean, final String name) throws BeanUtilException {
    Getter getter = getAccessor(bean.getClass(), name).getter;
    if (getter == null) {
        throw new BeanUtilException(StringUtil.format("Unable to get getter for {}#{}", bean.getClass(), name));
    }
    return getter.get(bean);
}
 
开发者ID:febit,项目名称:febit-common,代码行数:8,代码来源:BeanUtil.java

示例5: set

import org.febit.util.StringUtil; //导入方法依赖的package包/类
public static void set(final Object bean, final String name, Object value, boolean convertIfNeed) throws BeanUtilException {
    Setter setter = getAccessor(bean.getClass(), name).setter;
    if (setter == null) {
        throw new BeanUtilException(StringUtil.format("Unable to get setter for {}#{}", bean.getClass(), name));
    }
    if (convertIfNeed && (value == null || value instanceof String)) {
        value = Convert.convert((String) value, setter.getPropertyType());
    }
    setter.set(bean, value);
}
 
开发者ID:febit,项目名称:febit-common,代码行数:11,代码来源:BeanUtil.java

示例6: getAccessor

import org.febit.util.StringUtil; //导入方法依赖的package包/类
private static Accessor getAccessor(final Class cls, final String name) throws BeanUtilException {
    Map<String, Accessor> descs = CACHE.unsafeGet(cls);
    if (descs == null) {
        descs = CACHE.putIfAbsent(cls, AccessFactory.resolveAccessors(cls));
    }
    Accessor fieldDescriptor = descs.get(name);
    if (fieldDescriptor != null) {
        return fieldDescriptor;
    }
    throw new BeanUtilException(StringUtil.format("Unable to get field: {}#{}", cls.getName(), name));
}
 
开发者ID:febit,项目名称:febit-common,代码行数:12,代码来源:BeanUtil.java

示例7: formatMessage

import org.febit.util.StringUtil; //导入方法依赖的package包/类
public String formatMessage() {
    return StringUtil.format(this.message, args);
}
 
开发者ID:febit,项目名称:febit-common,代码行数:4,代码来源:Vtor.java


注:本文中的org.febit.util.StringUtil.format方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。