public double get(Object object) { try { return this.field.getDouble(object); } catch (Exception e) { return 0; } }
/** * Gets the value of a static <code>double</code> field. * * @param field Field object whose value is returned. * @return the value of the <code>double</code> field */ public static double getDouble(Field field) { checkStatic(field); try { return field.getDouble(null); } catch (Exception exp) { throw translate(exp); } }
/** * Gets the value of an instance <code>double</code> field. * * @param field Field object whose value is returned. * @param obj the object to extract the <code>double</code> value * from * @return the value of the <code>double</code> field */ public static double getDouble(Field field, Object obj) { try { return field.getDouble(obj); } catch (Exception exp) { throw translate(exp); } }
public double getReflectD() throws Exception { return f_d.getDouble(t); }
public double getDouble(Object o) throws IllegalArgumentException, IllegalAccessException { return this.field.getDouble(o); }
@Override void serialize(AbstractHessianOutput out, Object obj, Field field) throws IOException { double value = 0; try { value = field.getDouble(obj); } catch (IllegalAccessException e) { log.log(Level.FINE, e.toString(), e); } out.writeDouble(value); } }
public final double getDoubleValue(Object obj) throws IllegalAccessException { if (!isAndroid && memOffset >= 0) { return FSTUtil.unFlaggedUnsafe.getDouble(obj, memOffset); } return field.getDouble(obj); }
Field f = R.class.getField("_1st"); Class<?> t = f.getType(); if(t == int.class){ System.out.println(f.getInt(null)); }else if(t == double.class){ System.out.println(f.getDouble(null)); }...
/** Returns the pair of metric name and metric value. */ public Map<String, Double> toMap() { Map<String, Double> metricValues = new HashMap<>(); for (Field field : getClass().getDeclaredFields()) try { metricValues.put(field.getName(), field.getDouble(this)); } catch (IllegalAccessException e) { e.printStackTrace(); } return metricValues; } }
public static double callSetDouble(Field thiz, Object obj) throws IllegalArgumentException, IllegalAccessException { thiz.setDouble(obj, 1.234); return thiz.getDouble(obj); }
public final double getDoubleValue(Object obj) throws IllegalAccessException { if (!isAndroid && memOffset >= 0) { return FSTUtil.unFlaggedUnsafe.getDouble(obj, memOffset); } return field.getDouble(obj); }
@Override public String toString() { Field[] fields = getFields(this); String r=""; for( Field field : fields ){ String name = field.getName(); Class cl = field.getType(); try{ if( cl.isPrimitive() ){ if( cl == Boolean.TYPE ){ boolean curval = field.getBoolean(this); if( curval ) r += " -"+name; } else if( cl == Integer.TYPE ) r+=" -"+name+"="+field.getInt(this); else if( cl == Float.TYPE ) r+=" -"+name+"="+field.getFloat(this); else if( cl == Double.TYPE ) r+=" -"+name+"="+field.getDouble(this); else if( cl == Long.TYPE ) r+=" -"+name+"="+field.getLong(this); else continue; } else if( cl == String.class ) if (field.get(this)!=null) r+=" -"+name+"="+field.get(this); } catch( Exception e ) { Log.err("Argument failed with ",e); } } return r; } }
rep.append(joiner).append(name).append('=').append(val); } else if (type.equals(double.class)) { double val = ff.getDouble(this); rep.append(joiner).append(name).append('=').append(val); } else if (type.equals(Integer.class)) {
/** * Returns the value of the field in the specified object as a {@code * double}. This reproduces the effect of {@code object.fieldName} * <p> * If this field is static, the object argument is ignored. * Otherwise, if the object is {@code null}, a NullPointerException is * thrown. If the object is not an instance of the declaring class of the * method, an IllegalArgumentException is thrown. * <p> * If this Field object is enforcing access control (see AccessibleObject) * and this field is not accessible from the current context, an * IllegalAccessException is thrown. * * @param object * the object to access * @return the field value * @throws NullPointerException * if the object is {@code null} and the field is non-static * @throws IllegalArgumentException * if the object is not compatible with the declaring class * @throws IllegalAccessException * if this field is not accessible */ public double getDouble(Object object) throws IllegalAccessException, IllegalArgumentException { checkAccess(object, false); checkReceiver(object); return getDouble(object, getType(), Double.TYPE); }
output.writeChar(field.getChar(obj)); } else if (type == double.class) { output.writeDouble(field.getDouble(obj)); } else if (type == float.class) { output.writeFloat(field.getFloat(obj));
void serialize(AbstractHessianOutput out, Object obj, Field field) throws IOException { double value = 0; try { value = field.getDouble(obj); } catch (IllegalAccessException e) { log.log(Level.FINE, e.toString(), e); } out.writeDouble(value); } }
void serialize(AbstractHessianOutput out, Object obj, Field field) throws IOException { double value = 0; try { value = field.getDouble(obj); } catch (IllegalAccessException e) { log.log(Level.FINE, e.toString(), e); } out.writeDouble(value); } }
public void write (Output output, Object object) { try { output.writeDouble(field.getDouble(object)); } catch (Exception e) { KryoException ex = new KryoException(e); ex.addTrace(this + " (" + type.getName() + ")"); throw ex; } }
public void copy (Object original, Object copy) { try { field.setDouble(copy, field.getDouble(original)); } catch (Exception e) { KryoException ex = new KryoException(e); ex.addTrace(this + " (" + type.getName() + ")"); throw ex; } } }