在Java里很容易做到自定义有状态码和状态说明的枚举类例如: public enum MyStatus { NOT_FOUND(404, "Required resource is not found"); private final int code; private final String msg; private MyStatus (int code, String msg) { this.code= code; this.msg = msg; } public int get
/** * Interface defining a generic contract for attaching and accessing metadata * to/from arbitrary objects. *定义用于附加和访问元数据的通用的接口,来自任意对象 * @author Rob Harrop * @since 2.0 */ public interface AttributeAccessor { /** * Set the attribute defined by {@co
因为需要的确定状态太多,减少数据库的压力,采取二进制表示状态码 状态码工具类 package com.xmg.p2p.base.util; /** * 用户状态类,记录用户在平台使用系统中所有的状态. * * @author Administrator */ public class BitStatesUtils { public final static Long OP_BIND_PHONE = 1L << 0; // 用户绑定手机状态码 public final static Long O
上一篇分析了BeanFactory体系的2个类,SimpleAliasRegistry和DefaultSingletonBeanRegistry——Spring源码分析——BeanFactory体系之抽象类.类分析(一),今天继续分析. 一.工厂Bean注册支持——FactoryBeanRegistrySupport 废话不多说,直接看我注释的源码: /* * Copyright 2002-2012 the original author or authors. * * Licensed und
今天来分析Spring的资源接口Resource的各个实现类.关于它的接口和抽象类,参见上一篇博文——Spring源码分析——资源访问利器Resource之接口和抽象类分析 一.文件系统资源 FileSystemResource 文件系统资源 FileSystemResource,资源以文件系统路径的方式表示.这个类继承自AbstractResource,并实现了写的接口WritableResource.类全称为public class FileSystemResource extends Ab