/** * Synchronize the variable table with the argument. In real terms * this means copy all entries into a newly allocated table. */ protected void variableTableSync(List<Variable<Object>> vars) { synchronized(this) { for (Variable<Object> var : vars) { variableTableStore(var.getName(), var.getValue()); } } }
/** * Synchronize the variable table with the argument. In real terms * this means copy all entries into a newly allocated table. */ protected void variableTableSync(List<Variable<Object>> vars) { synchronized(this) { for (Variable<Object> var : vars) { variableTableStore(var.getName(), var.getValue()); } } }
/** * Synchronize the variable table with the argument. In real terms * this means copy all entries into a newly allocated table. */ protected void variableTableSync(List<Variable<Object>> vars) { synchronized(this) { for (Variable<Object> var : vars) { variableTableStore(var.getName(), var.getValue()); } } }
/** * Synchronize the variable table with the argument. In real terms * this means copy all entries into a newly allocated table. */ protected void variableTableSync(List<Variable<Object>> vars) { synchronized(this) { for (Variable<Object> var : vars) { variableTableStore(var.getName(), var.getValue()); } } }
/** * @see org.jruby.runtime.builtin.InstanceVariables#getInstanceVariableNameList */ @Override public void copyInstanceVariablesInto(final InstanceVariables other) { for (Variable<IRubyObject> var : getInstanceVariableList()) { synchronized (this) { other.setInstanceVariable(var.getName(), var.getValue()); } } }
/** * @see org.jruby.runtime.builtin.InstanceVariables#getInstanceVariableNameList */ @Override public void copyInstanceVariablesInto(final InstanceVariables other) { for (Variable<IRubyObject> var : getInstanceVariableList()) { synchronized (this) { other.setInstanceVariable(var.getName(), var.getValue()); } } }
/** * @see org.jruby.runtime.builtin.InstanceVariables#getInstanceVariableNameList */ public void copyInstanceVariablesInto(final InstanceVariables other) { for (Variable<IRubyObject> var : getInstanceVariableList()) { synchronized (this) { other.setInstanceVariable(var.getName(), var.getValue()); } } }
/** * @see org.jruby.runtime.builtin.InstanceVariables#getInstanceVariableNameList */ public void copyInstanceVariablesInto(final InstanceVariables other) { for (Variable<IRubyObject> var : getInstanceVariableList()) { synchronized (this) { other.setInstanceVariable(var.getName(), var.getValue()); } } }
/** inspect_obj * * The internal helper method that takes care of the part of the * inspection that inspects instance variables. */ private static StringBuilder inspectObj(IRubyObject self, StringBuilder part) { ThreadContext context = getRuntime(self).getCurrentContext(); String sep = ""; for (Variable<IRubyObject> ivar : getInstanceVariables(self).getInstanceVariableList()) { part.append(sep).append(' ').append(ivar.getName()).append('='); part.append(invokedynamic(context, ivar.getValue(), INSPECT)); sep = ","; } part.append('>'); return part; }
/** inspect_obj * * The internal helper method that takes care of the part of the * inspection that inspects instance variables. */ private static StringBuilder inspectObj(IRubyObject self, StringBuilder part) { ThreadContext context = getRuntime(self).getCurrentContext(); String sep = ""; for (Variable<IRubyObject> ivar : getInstanceVariables(self).getInstanceVariableList()) { part.append(sep).append(' ').append(ivar.getName()).append('='); part.append(invokedynamic(context, ivar.getValue(), INSPECT)); sep = ","; } part.append('>'); return part; }
/** inspect_obj * * The internal helper method that takes care of the part of the * inspection that inspects instance variables. */ private static StringBuilder inspectObj(IRubyObject self, StringBuilder part) { ThreadContext context = getRuntime(self).getCurrentContext(); String sep = ""; for (Variable<IRubyObject> ivar : getInstanceVariables(self).getInstanceVariableList()) { part.append(sep).append(" ").append(ivar.getName()).append("="); part.append(invokedynamic(context, ivar.getValue(), INSPECT)); sep = ","; } part.append(">"); return part; }
/** inspect_obj * * The internal helper method that takes care of the part of the * inspection that inspects instance variables. */ private static StringBuilder inspectObj(IRubyObject self, StringBuilder part) { ThreadContext context = getRuntime(self).getCurrentContext(); String sep = ""; for (Variable<IRubyObject> ivar : getInstanceVariables(self).getInstanceVariableList()) { part.append(sep).append(" ").append(ivar.getName()).append("="); part.append(invokedynamic(context, ivar.getValue(), INSPECT)); sep = ","; } part.append(">"); return part; }
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { RubyBasicObject o = (RubyBasicObject) source; RubyClass t = o.getType(); writer.addAttribute("ruby-class", t.getName()); Ruby runtime = o.getRuntime(); resolver.marshal(o,writer,context); boolean hasTransient = t.respondsTo("transient?"); for (Variable v : o.getVariableList()) { Object value = v.getValue(); if (value ==null) continue; String vname = v.getName().substring(1); // cut off the first '@' if (hasTransient && t.callMethod("transient?", runtime.newString(vname)).isTrue()) continue; // transient field writer.startNode(vname); if (!(value instanceof IRubyObject)) { // if a ruby object refers to another ruby object, just rely on @ruby-class // and we don't need @class Class<?> valueType = value.getClass(); String serializedClassName = mapper.serializedClass(valueType); writer.addAttribute("class", serializedClassName); } else { // TODO: use the type annotation to try to omit this whenever we can } context.convertAnother(value); writer.endNode(); } }