Setup meta-class special attributes, namespaces etc. This is called
        both for textX created classes as well as user classes.
340921
def _init_class(self, cls, peg_rule, position, position_end=None,
                    inherits=None, root=False, rule_type=RULE_MATCH):
        
        cls._tx_metamodel = self

        # Attribute information (MetaAttr instances) keyed by name.
        cls._tx_attrs = OrderedDict()

        # A list of inheriting classes
        cls._tx_inh_by = inherits if inherits else []

        cls._tx_position = position

        cls._tx_position_end = \
            position if position_end is None else position_end

        # The type of the rule this meta-class results from.
        # There are three rule types: common, abstract and match
        # Base types are match rules.
        cls._tx_type = rule_type

        cls._tx_peg_rule = peg_rule
        if peg_rule:
            peg_rule._tx_class = cls

        # Push this class and PEG rule in the current namespace
        current_namespace = self.namespaces[self._namespace_stack[-1]]
        cls._tx_fqn = self._cls_fqn(cls)
        current_namespace[cls.__name__] = cls

        if root:
            self.rootcls = cls
271739
public void setupFields()
    {
        FieldInfo field = null;
        field = new FieldInfo(this, ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
        field.setDataClass(Integer.class);
        field.setHidden(true);
        field = new FieldInfo(this, LAST_CHANGED, Constants.DEFAULT_FIELD_LENGTH, null, null);
        field.setDataClass(Date.class);
        field.setHidden(true);
        field = new FieldInfo(this, DELETED, 10, null, new Boolean(false));
        field.setDataClass(Boolean.class);
        field.setHidden(true);
        field = new FieldInfo(this, NAME, 50, null, null);
        field = new FieldInfo(this, PARENT_FOLDER_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
        field.setDataClass(Integer.class);
        field = new FieldInfo(this, SEQUENCE, 5, null, new Short((short)0));
        field.setDataClass(Short.class);
        field = new FieldInfo(this, COMMENT, Constants.DEFAULT_FIELD_LENGTH, null, null);
        field = new FieldInfo(this, CODE, 30, null, null);
        field = new FieldInfo(this, TYPE, 10, null, null);
        field = new FieldInfo(this, AUTO_DESC, 10, null, new Boolean(true));
        field.setDataClass(Boolean.class);
        field = new FieldInfo(this, PROGRAM, 255, null, null);
        field = new FieldInfo(this, PARAMS, Constants.DEFAULT_FIELD_LENGTH, null, null);
        field = new FieldInfo(this, ICON_RESOURCE, 255, null, null);
        field = new FieldInfo(this, KEYWORDS, 50, null, null);
        field = new FieldInfo(this, XML_DATA, Constants.DEFAULT_FIELD_LENGTH, null, null);
        field = new FieldInfo(this, MENUS_HELP, Constants.DEFAULT_FIELD_LENGTH, null, null);
    }
38755
def with_metaclass(meta, *bases):
    """"""

    class metaclass(meta):
        def __new__(cls, name, this_bases, d):
            return meta(name, bases, d)

    return type.__new__(metaclass, "temporary_class", (), {})
29124
private void setup (Parser parser)
    {
    if (parser == null) {
        throw new
        NullPointerException("Parser argument must not be null");
    }
    this.parser = parser;
    atts = new AttributesImpl();
    nsSupport = new NamespaceSupport();
    attAdapter = new AttributeListAdapter();
    }
457492
def _set_up_reference_fields(new_class):
        """"""
        if new_class.meta_.declared_fields:
            for _, field in new_class.meta_.declared_fields.items():
                if isinstance(field, Reference):
                    shadow_field_name, shadow_field = field.get_shadow_field()
                    setattr(new_class, shadow_field_name, shadow_field)
                    shadow_field.__set_name__(new_class, shadow_field_name)
107308
private void setup() {
        try {
            this.partBoundary = ("--" + boundary).getBytes("UTF-8");
            this.trailingBoundary = ("--" + boundary + "--").getBytes("UTF-8");
            this.contentType = "content-type: application/json".getBytes("UTF-8");
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }

        attachments = new ArrayList<Attachment>();

        // some preamble
        contentLength += partBoundary.length;
        contentLength += 6; // 3 * crlf
        contentLength += contentType.length;

        // although we haven't added it yet, account for the trailing boundary
        contentLength += 2; // crlf
        contentLength += trailingBoundary.length;
    }
1314854
def meta(opts = nil)
      if opts
        self.class.new(type.meta(opts), options)
      else
        type.meta
      end
    end
258990
private void initScriptClasses(Set<Class<?>> classes)throws Exception
	{
		Set<Class<? extends S>> scriptClass=findScriptClass(classes);
		Set<Class<? extends S>> instanceAbleScript = findInstanceAbleScript(scriptClass);
		Map<String, Class<? extends S>> nameMap_ = new HashMap<String, Class<? extends S>>();
		Map<Integer, Class<? extends S>> idMap_ = new HashMap<Integer, Class<? extends S>>();
		for(Class<? extends S> clazz:instanceAbleScript)
		{
			registScript(clazz, nameMap_, idMap_);
		}
		this.idMap.clear();
		this.nameMap.clear();
		this.idMap.putAll(idMap_);
		this.nameMap.putAll(nameMap_);
		_log.info("loadScriptClass complete,id mapping size:"+idMap.size()+",name mapping size:"+nameMap.size());
	}
306307
def _add_to_class(self, name, method):
        
        if hasattr(self._element_cls, name):
            return
        setattr(self._element_cls, name, method)
727510
protected void initParser() throws MtasConfigException {
    if (config != null) {
      // find namespaceURI
      for (int i = 0; i < config.children.size(); i++) {
        MtasConfiguration current = config.children.get(i);
        if (current.name.equals("autorepair")) {
          autorepair = current.attributes.get("value").equals("true");
        }
        if (current.name.equals("makeunique")) {
          makeunique = current.attributes.get("value").equals("true");
        }
      }
    }
  }
246651
@Setup
    public void setup() {
        proxyInterceptor = MethodDelegation.to(ByteBuddyProxyInterceptor.class);
        accessInterceptor = MethodDelegation.to(ByteBuddyAccessInterceptor.class);
        prefixInterceptor = MethodDelegation.to(ByteBuddyPrefixInterceptor.class);
        baseClassDescription = TypePool.Default.ofSystemLoader().describe(baseClass.getName()).resolve();
        proxyClassDescription = TypePool.Default.ofSystemLoader().describe(ByteBuddyProxyInterceptor.class.getName()).resolve();
        accessClassDescription = TypePool.Default.ofSystemLoader().describe(ByteBuddyAccessInterceptor.class.getName()).resolve();
        prefixClassDescription = TypePool.Default.ofSystemLoader().describe(ByteBuddyPrefixInterceptor.class.getName()).resolve();
        proxyInterceptorDescription = MethodDelegation.to(proxyClassDescription);
        accessInterceptorDescription = MethodDelegation.to(accessClassDescription);
        prefixInterceptorDescription = MethodDelegation.to(prefixClassDescription);
    }
790323
private void setupLabel() {
		// To retain compatibility with the WText API, create a WText for this component,
		// which gets added to the label body.
		WText textBody = new WText() {
			@Override
			public boolean isEncodeText() {
				return WHeading.this.isEncodeText();
			}

			@Override
			public String getText() {
				return WHeading.this.getText();
			}
		};

		if (label.getBody() == null) {
			label.setBody(textBody);
		} else {
			WComponent oldBody = label.getBody();

			WContainer newBody = new WContainer();
			label.setBody(newBody);

			newBody.add(textBody);
			newBody.add(oldBody);
		}
	}
276771
def set_meta(self, **kwargs):
        """"""
        for param in self.to_list():
            for k, v in kwargs.items():
                # Here we'll set the attributes (_context, _qualifier, etc)
                if getattr(param, '_{}'.format(k)) is None:
                    setattr(param, '_{}'.format(k), v)
777922
protected function setupObject()
    {
        $this->name = $this->getAttribute("name");
        $this->value = $this->getAttribute("value");
        $this->classname = $this->getAttribute("class");

        /*
        * Set some default values if they are not specified.
        * This is especially useful for maxLength; the size
        * is already known by the column and this way it is
        * not necessary to manage the same size two times.
        *
        * Currently there is only one such supported default:
        *   - maxLength value = column max length
        *   (this default cannot be easily set at runtime w/o changing
        *   design of class system in undesired ways)
        */
        if ($this->value === null) {
            switch ($this->name) {
                case 'maxLength':
                    $this->value = $this->validator->getColumn()->getSize();
                    break;
            }
        }

        $this->message = $this->getAttribute("message");
    }
600553
public static void setMetaClass(Class self, MetaClass metaClass) {
        final MetaClassRegistry metaClassRegistry = GroovySystem.getMetaClassRegistry();
        if (metaClass == null)
            metaClassRegistry.removeMetaClass(self);
        else {
            if (metaClass instanceof HandleMetaClass) {
                metaClassRegistry.setMetaClass(self, ((HandleMetaClass)metaClass).getAdaptee());
            } else {
                metaClassRegistry.setMetaClass(self, metaClass);
            }
            if (self==NullObject.class) {
                NullObject.getNullObject().setMetaClass(metaClass);
            }
        }
    }
701137
def _new_import(self, import_name):
        

        # Import can't be used if meta-model is loaded from string
        assert self.root_path is not None, \
            '"import" statement can not be used if meta-model is ' \
            'loaded from string.'

        # Find the absolute file name of the import based on the relative
        # import_name and current namespace
        current_namespace = self._namespace_stack[-1]
        if '.' in current_namespace:
            root_namespace = current_namespace.rsplit('.', 1)[0]
            import_name = "%s.%s" % (root_namespace, import_name)

        import_file_name = "%s.tx" % os.path.join(self.root_path,
                                                  *import_name.split("."))

        if import_name not in self.namespaces:
            self._enter_namespace(import_name)
            if self.debug:
                self.dprint("*** IMPORTING FILE: %s" % import_file_name)
            metamodel_from_file(import_file_name, metamodel=self)
            self._leave_namespace()

        # Add the import to the imported_namespaces for current namespace
        # so that resolving of current grammar searches imported grammars
        # in the order of import
        self._imported_namespaces[current_namespace].append(
            self.namespaces[import_name])
944602
def add_to_class(cls, name, value):
        
        if name == '_base_manager':
            if not value.name:
                value.name = name
            value.model = cls
            setattr(cls._meta, 'base_manager_name', 'normal')
        else:
            super(VersionModelMeta, cls).add_to_class(name, value)