Get value from the variable

@param method structure of setter method
@param variable the variable
@return a value
7873
protected Object getValue(SetterMethodCover method, Variable variable) {
        if(method.isTwoDimensionsArray()) 
            return assignValuesToTwoDimensionsArray(method, variable.getSFSArrayValue());
        if(method.isArray())
            return assignValuesToArray(method, variable);
        
        if(method.isColection())
            return assignValuesToCollection(method, variable);

        if(method.isObject())
            return assignValuesToObject(method, variable.getSFSObjectValue());
        if(method.isByte())
            return variable.getIntValue().byteValue();
        if(method.isChar())
            return (char)variable.getIntValue().byteValue();
        if(method.isFloat())
            return variable.getDoubleValue().floatValue();
        if(method.isLong())
            return variable.getDoubleValue().longValue();
        if(method.isShort())
            return variable.getIntValue().shortValue();
        return variable.getValue();
    }
933985
public Method getSetter(String name) throws NoSuchMethodException {
        Method method = setterMethods.get(name);
        if (method == null) {
            throw new NoSuchMethodException("There is no WRITABLE property named '" + name +
                    "' in class '" + className + "'");
        }
        return method;
    }
252467
public static Method getSetterPropertyMethod(Class<?> type,
			String propertyName) {
		String sourceMethodName = "set"
				+ BeanUtils.capitalizePropertyName(propertyName);

		Method sourceMethod = BeanUtils.getMethod(type, sourceMethodName);

		return sourceMethod;
	}
1044398
@Nullable
  public Value getLocalVariable(@Nullable final String name) {
    if (name == null) {
      return null;
    }

    final String normalized = assertNotNull(PreprocessorUtils.normalizeVariableName(name));

    if (normalized.isEmpty()) {
      return null;
    }

    return localVarTable.get(normalized);
  }
1182856
static boolean isJavaPropertyMethod(final String methodName) {
        return (methodName.length() > PROPERTY_METHOD_PREFIX_LEN
                && (methodName.startsWith("get") || methodName.startsWith(("set"))));
    }
321368
@Override
	public String onVariable(String variable) {
		switch(variable) {
		case "USERHOME":
			return System.getProperty("user.home");
		case "WINDIR":
			return System.getenv("windir");
		case "SYSTEMROOT":
			return System.getenv("SystemRoot");
		case "COMMONPROGRAMFILES":
			return System.getenv("CommonProgramFiles");
		case "PROGRAMFILES":
			return System.getenv("ProgramFiles");
		case "TEMP":
			return System.getenv("TEMP");
		case "SYSTEMDRIVE":
			return System.getenv("SystemDrive");
		case "USERPROFILE":
			return System.getenv("USERPROFILE");
		case "APPDATA":
			return System.getenv("APPDATA");
		}
		return null;
	}
169327
public Object getVariable(Object key) {
		Object object = null;

		for (int i = working.size() - 1; i >= 0; --i) {
			Map<Object, Object> map = working.get(i);
			object = map.get(key);
			if (object != null)
				break;
		}
		if (object == null)
			object = global.get(key);

		return object;
	}
86924
public static int setVariable(String varname, String varvalue) throws Exception {
    SessionState ss = SessionState.get();
    if (varvalue.contains("\n")){
      ss.err.println("Warning: Value had a \\n character in it.");
    }
    varname = varname.trim();
    if (varname.startsWith(ENV_PREFIX)){
      ss.err.println("env:* variables can not be set.");
      return 1;
    } else if (varname.startsWith(SYSTEM_PREFIX)){
      String propName = varname.substring(SYSTEM_PREFIX.length());
      System.getProperties().setProperty(propName,
              new VariableSubstitution().substitute(ss.getConf(),varvalue));
    } else if (varname.startsWith(HIVECONF_PREFIX)){
      String propName = varname.substring(HIVECONF_PREFIX.length());
      setConf(varname, propName, varvalue, true);
    } else if (varname.startsWith(HIVEVAR_PREFIX)) {
      String propName = varname.substring(HIVEVAR_PREFIX.length());
      ss.getHiveVariables().put(propName,
              new VariableSubstitution().substitute(ss.getConf(),varvalue));
    } else if (varname.startsWith(METACONF_PREFIX)) {
      String propName = varname.substring(METACONF_PREFIX.length());
      Hive hive = Hive.get(ss.getConf());
      hive.setMetaConf(propName, new VariableSubstitution().substitute(ss.getConf(), varvalue));
    } else {
      setConf(varname, varname, varvalue, true);
    }
    return 0;
  }
671900
private static Variable toVariable(final String argument)
   {
      final Variable retVal = new Variable();
      final int equalSignIndex = argument.indexOf('=');

      if (equalSignIndex == -1)
      {
         final String key = argument.substring(2);
         retVal.setKey(key);
      }
      else
      {
         final String key = argument.substring(2, equalSignIndex);
         retVal.setKey(key);
         final String value = argument.substring(equalSignIndex + 1);
         retVal.setValue(value);
      }

      return retVal;
   }
152554
public ValueExpression resolveVariable(String variable)
    {
        ValueExpression ve = null;
        try
        {
            if (_vars != null)
            {
                ve = (ValueExpression) _vars.get(variable);

                // Is this code in a block that wants to cache 
                // the resulting expression(s) and variable has been resolved?
                if (_trackResolveVariables && ve != null)
                {
                    _variableResolved = true;
                }
            }
            
            if (ve == null)
            {
                return _target.resolveVariable(variable);
            }
            
            return ve;
        }
        catch (StackOverflowError e)
        {
            throw new ELException("Could not Resolve Variable [Overflow]: " + variable, e);
        }
    }
607466
@Override
    @SuppressWarnings("unchecked")
    public <T> T get(final String varName, Class<T> clazz) {
        return (T) get(varName);
    }
366580
public Object getMethodConfigValue(String methodName, String configKey, Object defaultValue) {
        Object value = getMethodConfigValue(methodName, configKey);
        return value == null ? defaultValue : value;
    }
846654
@SuppressWarnings("rawtypes")
    protected Object getValue(GetterMethodCover method, Object value) {
        if(method.isByte()) {
            value = ((Byte)value).intValue();
        }
        else if(method.isChar()) {
            value = (int)((Character)value).charValue();
        }
        else if(method.isFloat()) {
            value = ((Float)value).doubleValue();
        }
        else if(method.isLong()) {
            value = ((Long)value).doubleValue();
        }
        else if(method.isShort()) {
            value = ((Short)value).intValue();
        }
        else if(method.isObject()) {
            value = parseObject(method, value);
        }
        else if(method.isObjectArray()) {
            value = parseArray(method, value);
        }
        else if(method.isArrayObjectCollection()) {
            return parseArrayObjectCollection(method, (Collection)value);
        }
        else if(method.isObjectCollection()) {
            return parseObjectCollection(method, (Collection)value);
        }
        else if(method.isArrayCollection()) {
            return parseArrayCollection(method, (Collection)value);
        }
        else if(method.isArray() || method.isColection()) {
            return transformSimpleValue(value);
        }
	    return value;
	}
872665
def _get_variable_value(defined_variables, name):
    
    def fallback(*args, **kwargs):
        raise AssertionError("Variable {0} is not defined in class {1}".format(
                name, defined_variables.__class__.__name__))
    method = getattr(defined_variables, name, fallback)
    val = method()
    return method.field_type(val)
62539
public Set<MemberLookupResult> performMemberLookup(String variable) {
    // if there is more than one "." we need to do some magic and resolve the definition fragmented
    if (variable.contains(".")) {
      return performNestedLookup(variable);
    }

    Set<MemberLookupResult> ret = new LinkedHashSet<>();
    // check, if the current variable resolves to a data-sly-use command
    ParsedStatement statement = getParsedStatement(variable);
    if (statement == null) {
      return ret;
    }
    if (StringUtils.equals(statement.getCommand(), DataSlyCommands.DATA_SLY_USE.getCommand())) {
      // this ends the search and we can perform the actual lookup
      ret.addAll(getResultsForClass(statement.getValue(), variable));
    }
    else {
      Set<MemberLookupResult> subResults = performMemberLookup(StringUtils.substringBefore(statement.getValue(), "."));
      for (MemberLookupResult result : subResults) {
        if (result.matches(StringUtils.substringAfter(statement.getValue(), "."))) {
          ret.addAll(getResultsForClass(result.getReturnType(), variable));
        }
      }
    }
    return ret;
  }
830903
public SDVariable getVariable(String name) {
        Variable v = variables.get(name);
        return v == null ? null : v.getVariable();
    }
922407
static boolean isSetterMethod(final Method method) {
        return method.getName().startsWith(SETTER_METHOD_PREFIX)
                &&
                Builder.class.isAssignableFrom(method.getReturnType())
                &&
                !method.isVarArgs()
                &&
                method.getParameterTypes().length == 1;
    }