java接口注释,api注释说明

System下的 arraycopy

/**

*

* @param src 源数组

* @param srcPos 源数组复制的开始位置

* @param dest 目标数组

* @param destPos 目标数组放置的开始位置

* @param length 复制的长度

*/

public static void arraycopy(Object src,int srcPos,Object dest,int destPos,int length)

常在数组扩容和移动处使用

public void expandCapacity(int minimumCapacity) {

if (maxBufSize != -1 && minimumCapacity >= maxBufSize) {

throw new JSONException("serialize exceeded MAX_OUTPUT_LENGTH=" + maxBufSize + ", minimumCapacity=" + minimumCapacity);

}

int newCapacity = buf.length + (buf.length >> 1) + 1;

if (newCapacity < minimumCapacity) {

newCapacity = minimumCapacity;

}

char newValue[] = new char[newCapacity];

System.arraycopy(buf, 0, newValue, 0, count);

buf = newValue;

}

Class类中的 isInstance(Object obj)和isAssignableFrom(Class> cls)

判定类或者接口相同, 或者是指定的是是其超类或者超接口

public boolean isInstance(Object obj) {

if (obj == null) {

return false;

}

return isAssignableFrom(obj.getClass());

}

public boolean isAssignableFrom(Class> cls) {

if (this == cls) {

return true; // Can always assign to things of the same type.

} else if (this == Object.class) {

return !cls.isPrimitive(); // Can assign any reference to java.lang.Object.

} else if (isArray()) {

return cls.isArray() && componentType.isAssignableFrom(cls.componentType);

} else if (isInterface()) {

// Search iftable which has a flattened and uniqued list of interfaces.

Object[] iftable = cls.ifTable;

if (iftable != null) {

for (int i = 0; i < iftable.length; i += 2) {

if (iftable[i] == this) {

return true;

}

}

}

return false;

} else {

if (!cls.isInterface()) {

for (cls = cls.superClass; cls != null; cls = cls.superClass) {

if (cls == this) {

return true;

}

}

}

return false;

}

}

glide中使用

public class ImageViewTargetFactory {

@NonNull

@SuppressWarnings("unchecked")

public ViewTarget buildTarget(@NonNull ImageView view,

@NonNull Class clazz) {

if (Bitmap.class.equals(clazz)) {

return (ViewTarget) new BitmapImageViewTarget(view);

} else if (Drawable.class.isAssignableFrom(clazz)) {

return (ViewTarget) new DrawableImageViewTarget(view);

} else {

throw new IllegalArgumentException(

"Unhandled class: " + clazz + ", try .as*(Class).transcode(ResourceTranscoder)");

}

}

}

Java String类中的intern()

如果常量池中有一个String对象的字符串就返回池中的这个字符串的String对象;否则,将此String对象包含的字符串添加到常量池中去,并且返回此String对象的引用

/**

* Returns a canonical representation for the string object.

*

* A pool of strings, initially empty, is maintained privately by the

* class {@code String}.

*

* When the intern method is invoked, if the pool already contains a

* string equal to this {@code String} object as determined by

* the {@link #equals(Object)} method, then the string from the pool is

* returned. Otherwise, this {@code String} object is added to the

* pool and a reference to this {@code String} object is returned.

*

* It follows that for any two strings {@code s} and {@code t},

* {@code s.intern() == t.intern()} is {@code true}

* if and only if {@code s.equals(t)} is {@code true}.

*

* All literal strings and string-valued constant expressions are

* interned. String literals are defined in section 3.10.5 of the

* The Java™ Language Specification.

*

* @return a string that has the same contents as this string, but is

* guaranteed to be from a pool of unique strings.

*/

@FastNative

public native String intern();

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
目录 ................................................................................................................................................................................... 5  1.  通用注解、API、客户程序和实现模型 ................................................................................................................. 7  1.1. 简介 ........................................................................................................................................................................... 7  1.2. 实现的元数据 ........................................................................................................................................................... 7  1.2.1. 服务元数据 ............................................................................................................................................................ 8  1.2.2.@Reference ........................................................................................................................................................... 8  1.2.3. @Property ............................................................................................................................................................. 9  1.2.4. 实现作用域:@Scope、@Init、@Destroy ....................................................................................................... 9  1.3 接口元数据 .............................................................................................................................................................. 10  1.3.1. @Remotable ....................................................................................................................................................... 10  1.3.2. @Conversational ................................................................................................................................................ 11  1.4. 客户 API .................................................................................................................................................................. 11  1.4.1. SCA构件访问服务 .............................................................................................................................................. 11  1.4.2. 非 SCA构件的实现访问服务 ............................................................................................................................ 11  1.5. 错误处理 ................................................................................................................................................................. 12  1.6. 异步与会话编程 ..................................................................................................................................................... 12  1.6.1. @OneWay ........................................................................................................................................................... 12 

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值