1 /* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package android.util; 17 18 /** 19 * An implementation of {@link android.util.Property} to be used specifically with fields of type 20 * <code>float</code>. This type-specific subclass enables performance benefit by allowing 21 * calls to a {@link #setValue(Object, float) setValue()} function that takes the primitive 22 * <code>float</code> type and avoids autoboxing and other overhead associated with the 23 * <code>Float</code> class. 24 * 25 * @param <T> The class on which the Property is declared. 26 */ 27 public abstract class FloatProperty<T> extends Property<T, Float> { 28 29 public FloatProperty(String name) { 30 super(Float.class, name); 31 } 32 33 /** 34 * A type-specific variant of {@link #set(Object, Float)} that is faster when dealing 35 * with fields of type <code>float</code>. 36 */ 37 public abstract void setValue(T object, float value); 38 39 @Override 40 final public void set(T object, Float value) { 41 setValue(object, value); 42 } 43 44 }