/* * Copyright (c) 2016 Zhang Hai <Dreaming.in.Code.ZH@Gmail.com> * All Rights Reserved. */ package me.zhanghai.android.douya.ui; import android.util.Property; /** * From {@code android.util.IntProperty}. * * An implementation of {@link Property} to be used specifically with fields of type * <code>int</code>. This type-specific subclass enables performance benefit by allowing * calls to a {@link #set(Object, Integer) set()} function that takes the primitive * <code>int</code> type and avoids autoboxing and other overhead associated with the * <code>Integer</code> class. * * @param <T> The class on which the Property is declared. */ public abstract class IntProperty<T> extends Property<T, Integer> { public IntProperty(String name) { super(Integer.class, name); } /** * A type-specific override of the {@link #set(Object, Integer)} that is faster when dealing * with fields of type <code>int</code>. */ public abstract void setValue(T object, int value); @Override final public void set(T object, Integer value) { setValue(object, value); } }