Return an instance of the given type if it receives special handling by {@code String.format}.
For example, an intance of {@link Integer} will be returned for an input of type {@code int} or
{@link Integer}.
333678
@Nullable
  private static Object getInstance(Tree tree, VisitorState state) {
    Object value = ASTHelpers.constValue(tree);
    if (value != null) {
      return value;
    }
    Type type = ASTHelpers.getType(tree);
    return getInstance(type, state);
  }
496669
public int readInt()
        throws IOException
    {
        int tag = read();

        switch (tag) {
            case 'T':
                return 1;
            case 'F':
                return 0;
            case 'I':
                return parseInt();
            case 'L':
                return (int) parseLong();
            case 'D':
                return (int) parseDouble();

            default:
                throw expect("int", tag);
        }
    }
982367
public static Integer getInteger(Object object) {
        try {
            if(object instanceof Integer)
                return (Integer) object;

            if(object instanceof String)
                return Integer.valueOf((String) object);
        } catch(NumberFormatException  nfe) {
        }
        return null;
    }
1027641
public int getInt(Integer type)
   {
      int result = 0;

      byte[] item = m_map.get(type);
      if (item != null)
      {
         result = MPPUtility.getInt(item, 0);
      }

      return (result);
   }
1307721
public Integer getAsInteger(String key) {
        Object value = mValues.get(key);
        try {
            return value != null ? ((Number) value).intValue() : null;
        } catch (ClassCastException e) {
            if (value instanceof CharSequence) {
                try {
                    return Integer.valueOf(value.toString());
                } catch (NumberFormatException e2) {
                    DLog.e(TAG, "Cannot parse Integer value for " + value + " at key " + key);
                    return null;
                }
            } else {
                DLog.e(TAG, "Cannot cast value for " + key + " to a Integer: " + value, e);
                return null;
            }
        }
    }
894360
public Obj get(String type, String id) throws Exception {
		return get(type, id, type);
	}
1177410
public Boolean isInputFormat(ProvFormat format) {
        ProvFormatType t = provTypeMap.get(format);
        return (t.equals(ProvFormatType.INPUT) || 
                t.equals(ProvFormatType.INPUTOUTPUT));
    }
697228
public Integer getInteger(String key) {
        try {
            return getValue(Integer.class, key);
        } catch (ClassCastException e) {
            String value = getString(key);

            return Integer.parseInt(value.split(",")[0]);
        }
    }
606823
public static Reader reader(Format type, InputStream in) {
        return reader(type, in, defaultDefaultReadHandler());
    }
81595
public static Integer getAsInteger(Object value) {
		Integer result = null;

		try {
			if (value instanceof String) {
				result = Integer.valueOf((String) value);
			} else if (value instanceof Number) {
				result = ((Number) value).intValue();
			} else {
				result = null;
			}
		} catch (Exception e) {
			result = null;
		}

		return result == null ? 0 : result;
	}
1214026
public static Date getInstance(final java.util.Date date, final Value type) {
        if (Value.DATE.equals(type)) {
            return new Date(date);
        }
        return new DateTime(date);
    }
1060526
public Tuple<String, Boolean> decodeFormat (int type, String format)
    {
        boolean quotes = true;
        switch (placeOf(type)) {
        // derived classes may wish to change the format here based on the place
        case PLACE:
            switch (modeOf(type)) {
            case EMOTE:
                quotes = false;
                break;
            }
            break;
        }
        return Tuple.newTuple(format, quotes);
    }
384962
public static String getVariableType(String type) throws IOException {
        if (getVariableTypes() != null) {
            String newType = getVariableTypes().get(type);
            if (newType != null)
                return newType;
        }
        return type;
    }
177970
public static Class<?> getClassFromType(final Type type) {
        Class<?> returnClass = null;
        if (type instanceof Class<?>) {
            returnClass = (Class<?>) type;
        } else if (type instanceof ParameterizedType) {
            returnClass = getClassFromType(((ParameterizedType) type).getRawType());
        }
        return returnClass;
    }
486419
public static Integer hexToIntObject(@NotNull String str) {
		// 统一行为，不要有时候抛NPE，有时候抛NumberFormatException
		if (str == null) {
			throw new NumberFormatException("null");
		}
		return Integer.decode(str);
	}
393476
public Integer getAsInteger() {
		if (value instanceof String) {
			return Integer.valueOf((String)value);
		} else if (value instanceof Long) {
			return ((Long)value).intValue();
		}
		return (Integer)value;
	}
294903
public static final Integer getInteger(String value)
   {
      Integer result;

      try
      {
         result = Integer.valueOf(Integer.parseInt(value));
      }

      catch (Exception ex)
      {
         result = null;
      }

      return (result);
   }