com.google.gwt.emul.java.lang.reflect.Short_Field Maven / Gradle / Ivy
The newest version!
package java.lang.reflect;
import com.google.gwt.core.client.JavaScriptObject;
import java.lang.annotation.Annotation;
import java.util.function.Supplier;
/**
* A field representing a primitive short.
*
* @author "[email protected]"
*
*/
public final class Short_Field extends Field {
public Short_Field(Class declaringClass, String name, int modifiers,
JavaScriptObject accessor, Supplier annos) {
super(short.class, declaringClass, name, modifiers, accessor, annos);
}
protected final Object nativeGet(Object obj) {
return new Short(primitiveGet(obj));
}
protected final void nativeSet(Object obj, Object value) {
primitiveSet(obj, ((Number) value).shortValue());
}
protected boolean isNotAssignable (Class c) {
if (c == Short.class)
return false;
return c != Byte.class;
}
protected final native short primitiveGet(Object obj)
/*-{
return [email protected]::accessor.getter(obj);
}-*/;
protected final native void primitiveSet(Object obj, short value)
/*-{
[email protected]::accessor.setter(obj, value);
}-*/;
protected boolean nullNotAllowed() {
return true;
}
public final short getShort(Object obj) throws IllegalArgumentException,
IllegalAccessException {
maybeThrowNull(obj);
return primitiveGet(obj);
}
public final int getInt(Object obj) throws IllegalArgumentException,
IllegalAccessException {
maybeThrowNull(obj);
return primitiveGet(obj);
}
public final long getLong(Object obj) throws IllegalArgumentException,
IllegalAccessException {
maybeThrowNull(obj);
return primitiveGet(obj);
}
public final float getFloat(Object obj) throws IllegalArgumentException,
IllegalAccessException {
maybeThrowNull(obj);
return primitiveGet(obj);
}
public final double getDouble(Object obj) throws IllegalArgumentException,
IllegalAccessException {
maybeThrowNull(obj);
return primitiveGet(obj);
}
public final void setShort(Object obj, short s)
throws IllegalArgumentException, IllegalAccessException {
maybeThrowNull(obj);
primitiveSet(obj, s);
}
}