TODO: Generate accessor methods from GIR at class definition time
775146
def method_missing(method, *args)
      getter_name = "get_#{method}"
      return send(getter_name, *args) if respond_to?(getter_name)

      if method.to_s =~ /(.*)=$/
        setter_name = "set_#{Regexp.last_match[1]}"
        return send(setter_name, *args) if respond_to?(setter_name)
      end
      super
    end
1208250
private MethodDeclaration generateGetParamMethodForSoyElementClass(
      TemplateParam param, boolean isAbstract) {
    JsType jsType = JsType.forIncrementalDomState(param.type());
    String accessorSuffix =
        Ascii.toUpperCase(param.name().substring(0, 1)) + param.name().substring(1);
    if (isAbstract) {
      return MethodDeclaration.create(
          "get" + accessorSuffix,
          JsDoc.builder()
              .addAnnotation("abstract")
              .addParameterizedAnnotation("return", jsType.typeExpr())
              .build(),
          Statement.of(ImmutableList.of()));
    }
    Expression value = id("this").dotAccess("data").dotAccess(param.name());
    if (param.hasDefault()) {
      value =
          templateTranslationContext
              .codeGenerator()
              .declarationBuilder()
              .setRhs(value)
              .build()
              .ref();
      value =
          value.withInitialStatement(
              genParamDefault(
                  param,
                  value,
                  alias,
                  getJsTypeForParamTypeCheck(param.type()),
                  /* declareStatic= */ false));
    }
    MethodDeclaration getParamMethod =
        MethodDeclaration.create(
            "get" + accessorSuffix,
            JsDoc.builder().addAnnotation("override").addAnnotation("public").build(),
            Statement.returnValue(value));
    return getParamMethod;
  }
1014863
def get_attrs(cls):
        
        ignore = dir(type('dummy', (object,), {})) + ['__metaclass__']
        attrs = [
            item for item in inspect.getmembers(cls) if item[0] not in ignore
            and not isinstance(
                item[1], (
                    types.FunctionType,
                    types.MethodType,
                    classmethod,
                    staticmethod,
                    property))]
        # sort by idx and use attribute name to break ties
        attrs.sort(key=lambda attr: (getattr(attr[1], 'idx', -1), attr[0]))
        return attrs
1347494
public static Method getGenericAccessor(Class<?> clazz, String field) {
        LOG.trace( "getGenericAccessor({}, {})", clazz, field );

        String accessorQualifiedName = new StringBuilder(clazz.getCanonicalName())
			.append(".").append(field).toString();

        return accessorCache.computeIfAbsent(accessorQualifiedName, key ->
        	Stream.of( clazz.getMethods() )
            .filter( m -> Optional.ofNullable( m.getAnnotation( FEELProperty.class ) )
                    .map( ann -> ann.value().equals( field ) )
                    .orElse( false )
            )
            .findFirst()
            .orElse( getAccessor( clazz, field ) ));
    }
48757
function accessor(prop, arg) {
    return (arg === undefined) ? getter(prop) : setter(prop, arg);
  }
972673
private static MappedField checkAccessors(XML xml, Class<?> aClass, Field nestedField){

		MappedField field = checkGetAccessor(xml, aClass, nestedField);
		verifySetterMethods(aClass,field);
		return field;
	}
983270
void generateEisCode(Definition def)
   {
      try
      {
         String clazzName = this.getClass().getPackage().getName() + ".code.TestEisCodeGen";
         String javaFile = def.getDefaultValue() + "Handler.java";
         FileWriter fw = Utils.createTestFile(javaFile, def.getRaPackage(), def.getOutputDir());

         Class<?> clazz = Class.forName(clazzName, true, Thread.currentThread().getContextClassLoader());
         AbstractCodeGen codeGen = (AbstractCodeGen) clazz.newInstance();

         codeGen.generate(def, fw);

         fw.flush();
         fw.close();
      }
      catch (Exception e)
      {
         e.printStackTrace();
      }
   }
646592
Method getSetter(Method getter) {
        synchronized (setterCache) {
            if ( !setterCache.containsKey(getter) ) {
                String fieldName = ReflectionUtils.getFieldNameByGetter(getter, false);
                String setterName = "set" + fieldName;
                Method setter = null;
                try {
                    setter = getter.getDeclaringClass().getMethod(setterName, getter.getReturnType());
                } catch ( NoSuchMethodException e ) {
                    throw new DynamoDBMappingException("Expected a public, one-argument method called " + setterName
                            + " on " + getter.getDeclaringClass(), e);
                } catch ( SecurityException e ) {
                    throw new DynamoDBMappingException("No access to public, one-argument method called " + setterName
                            + " on " + getter.getDeclaringClass(), e);
                }
                setterCache.put(getter, setter);
            }
            return setterCache.get(getter);
        }
    }
473470
private String getReplicaMethodDelegationCode(Class<?> clazz, CtMethod ctMethod, String classOrInstanceToDelegateTo)
            throws NotFoundException {
        StringBuilder builder = new StringBuilder();
        builder.append("{java.lang.reflect.Method originalMethod = ");
        builder.append(clazz.getName());
        builder.append(".class.getDeclaredMethod(\"");
        builder.append(ctMethod.getName());
        builder.append("\", ");
        final String parametersAsString = getParametersAsString(getParameterTypes(ctMethod));
        if ("".equals(parametersAsString)) {
            builder.append("null");
        } else {
            builder.append(parametersAsString);
        }
        builder.append(");\n");
        builder.append("originalMethod.setAccessible(true);\n");
        final CtClass returnType = ctMethod.getReturnType();
        final boolean isVoid = returnType.equals(CtClass.voidType);
        if (!isVoid) {
            builder.append("return (");
            builder.append(returnType.getName());
            builder.append(") ");
        }
        builder.append("originalMethod.invoke(");
        if (Modifier.isStatic(ctMethod.getModifiers()) || classOrInstanceToDelegateTo == null) {
            builder.append(clazz.getName());
            builder.append(".class");
        } else {
            builder.append(classOrInstanceToDelegateTo);
        }
        builder.append(", $args);}");
        return builder.toString();
    }
385717
public static void registerAccessor(Class<?> documentType, DocumentAccessor accessor) {
		Assert.notNull(documentType, "documentType may not be null");
		Assert.notNull(accessor, "accessor may not be null");
		if (accessors.containsKey(documentType)) {
			DocumentAccessor existing = getAccessor(documentType);
			LOG.warn(String.format("DocumentAccessor for class %s already exists: %s will be overridden by %s", documentType, existing.getClass(), accessor.getClass()));
		}
		putAccessor(documentType, accessor);
		LOG.debug("Registered document accessor: {} for class: {}", accessor.getClass(), documentType);
	}
848654
function accessor(object) {
    var ref = object || (1, eval)('this');
    var len = parts.length;
    var idx = 0;

    // iteratively save each segment's reference
    for (; idx < len; idx += 1) {
      if (ref) ref = ref[parts[idx]];
    }

    return ref;
  }
822176
function createAggregator(setter, initializer) {
  return function(collection, iteratee) {
    var func = isArray_1(collection) ? _arrayAggregator : _baseAggregator,
        accumulator = initializer ? initializer() : {};

    return func(collection, setter, _baseIteratee(iteratee, 2), accumulator);
  };
}
772694
private static Class<?>[] getGeneratorInterfaces(ResourceGenerator generator) {

		Set<Class<?>> interfaces = new HashSet<>();
		addInterfaces(generator, interfaces);
		return (Class[]) interfaces.toArray(new Class[] {});
	}
124024
def _generate_constructor(cls, names):
        """"""

        cache = cls._constructors
        if names in cache:
            return cache[names]
        elif len(cache) > 3:
            cache.clear()

        func = generate_constructor(cls, names)
        cache[names] = func
        return func
719326
@Override
  public MethodVisitor visitMethod(int access, String name, String desc,
                                   String signature, String[] exceptions) {
    MethodVisitor mv = cv.visitMethod(access | Opcodes.ACC_SYNTHETIC,
                                      name, desc, signature, exceptions);
    return new AccessMethodAdapter(mv);
  }
610765
function (Class, descriptors) {
    var body = '"use strict";\n';
    var casters = {};
    each(descriptors, function (descriptor, name) {
      if (descriptor.writable || typeof descriptor.set === 'function') {
        var accessor = createAccessor(name);
        if (descriptor.cast || descriptor.type) {
          casters[name] = Casting.forDescriptor(descriptor);
          body += 'if (config' + accessor + ' !== undefined) {\n\
                      this' + accessor + ' = casters' + accessor + '(config' + accessor + ');\n\
                   }\n';
        }
        else {
          body += 'if (config' + accessor + ' !== undefined) {\n\
                      this' + accessor + ' = config' + accessor + ';\n\
                   }\n';
        }
      }
    });
    var configure = this.createDynamicFunction('casters', 'config', body);
    var fn = function (config) {
      return configure.call(this, casters, config);
    };
    fn.isAutoGenerated = true;
    return fn;
  }
1097648
private void genGetAllMethod(SourceWriter sw, JMethod[] methods,
      TreeLogger treeLogger) {
    sw.println("public DeferredSelector[] getAllSelectors() {return ds;}");
    sw.println("private final DeferredSelector[] ds = new DeferredSelector[] {");
    sw.indent();
    for (JMethod m : methods) {
      Selector selectorAnnotation = m.getAnnotation(Selector.class);
      if (selectorAnnotation == null) {
        continue;
      }
      String selector = selectorAnnotation.value();

      sw.println("new DeferredSelector() {");
      sw.indent();
      sw
          .println("public String getSelector() { return \"" + selector
              + "\"; }");
      sw
          .println("public NodeList<Element> runSelector(Node ctx) { return " +
              (m.getName() + (m.getParameters().length == 0 ? "()" : "(ctx)")) +
              ("NodeList".equals(m.getReturnType().getSimpleSourceName()) ? "" : ".get()") + ";}"
          );
      sw.outdent();
      sw.println("},");
    }
    sw.outdent();
    sw.println("};");
  }