Registers a {@link ModelElementType} in this {@link Model}.

@param modelElementType  the element type to register
@param instanceType  the instance class of the type to register
776334
public void registerType(ModelElementType modelElementType, Class<? extends ModelElementInstance> instanceType) {
    QName qName = ModelUtil.getQName(modelElementType.getTypeNamespace(), modelElementType.getTypeName());
    typesByName.put(qName, modelElementType);
    typesByClass.put(instanceType, modelElementType);
  }
1176942
public static void buildConstructors(Elements elementUtils, ModelClass<?> entity) {
		List<? extends Element> list = elementUtils.getAllMembers(entity.getElement());
		ExecutableElement constructor;
		List<List<Pair<String, TypeName>>> constructors = new ArrayList<>();

		// int i = 0;
		// AnnotationProcessorUtilis.printMessage((i++) + "**** " + entity.getName() + " BEGIN ****\n");

		for (Element item : list) {
			if (item.getKind() == ElementKind.CONSTRUCTOR && item.getModifiers().contains(Modifier.PUBLIC)) {
				constructor = (ExecutableElement) item;

				// AnnotationProcessorUtilis.printMessage((i++) + "Contructor(\n");

				ArrayList<Pair<String, TypeName>> params = new ArrayList<>();
				for (VariableElement p : constructor.getParameters()) {
					// AnnotationProcessorUtilis.printMessage(
					// (i++) + p.getSimpleName().toString() + " [" + TypeName.get(p.asType()) + "]\n");
					//
					params.add(new Pair<String, TypeName>(p.getSimpleName().toString(), TypeName.get(p.asType())));
				}

				// AnnotationProcessorUtilis.printMessage((i++) + ")\n\n");

				constructors.add(params);
			}

		}

		// check if it has an empty constructor;
		for (List<Pair<String, TypeName>> currentConstructor : constructors) {
			if (currentConstructor.size() == 0) {
				entity.emptyContructor = true;
			} else if (currentConstructor.size() == entity.getImmutableCollection().size()) {
				// check if it is a immutable constructor
				Map<String, ModelProperty> items = new HashMap<>();

				for (ModelProperty property : entity.getImmutableCollection()) {
					items.put(property.name, property);
				}

				// size is the same
				boolean immutableConstructor = true;
				for (Pair<String, TypeName> arg : currentConstructor) {
					ModelProperty temp = items.get(arg.value0);

					if (temp == null || !temp.isType(arg.value1)) {
						// property is not present
						immutableConstructor = false;
						break;
					}
				}
				if (immutableConstructor) {
					entity.immutableConstructors = currentConstructor;
				}
			}
		}

		// check for immutable constructor
		if (entity.immutableConstructors != null) {
			for (Pair<String, TypeName> currentConstructor : entity.immutableConstructors) {
				ModelProperty associatedProperty = entity.findImmutablePropertyByName(currentConstructor.value0);
				TypeName associatedType = currentConstructor.value1;

				AssertKripton.assertTrueOfInvalidConstructorProperty(
						associatedProperty == null || TypeUtility
								.isTypeEquals(associatedProperty.getPropertyType().getTypeName(), associatedType),
						entity, currentConstructor.value0);

			}
		}

		boolean allFieldWritable = true;
		// we have to check writeability only for valid properties (enabled)
		for (ModelProperty property : entity.collection) {
			allFieldWritable = allFieldWritable
					&& (property.isPublicField() || property.isFieldWithSetter());

		}
		entity.allPropertyWritable = allFieldWritable;

		// AnnotationProcessorUtilis.printMessage((i++) + "entity.emptyContructor=" + entity.emptyContructor + "\n");
		// AnnotationProcessorUtilis
		// .printMessage((i++) + "entity.immutableConstructors=" + entity.immutableConstructors + "\n");
		// AnnotationProcessorUtilis.printMessage((i++) + "entity.immutablePojo is " + entity.isImmutablePojo() + "\n");
		// AnnotationProcessorUtilis.printMessage((i++) + "entity.mutablePojo is " + entity.isMutablePojo() + "\n");

		// for (ModelProperty p: entity.getCollection()) {
		// AnnotationProcessorUtilis.printMessage(String.format((i++) + "property %s [%s] public=%s getter=%s is=%s setter=%s ", p.getName(), p.getPropertyType().typeName,
		// p.isFieldWithGetter(), p.isFieldWithGetter(), p.isFieldWithIs(), p.isFieldWithSetter()));
		// }

		AssertKripton.assertTrueOfInvalidConstructor(
				entity.emptyContructor == true || entity.immutableConstructors != null, entity);

		// if we have only emptyContructor, all property must be writable
		if (entity.emptyContructor == true && entity.immutableConstructors == null) {
			AssertKripton.assertTrueOfInvalidWritable(entity.allPropertyWritable, entity);
		}

		// AnnotationProcessorUtilis.printMessage((i++) + "**** " + entity.getName() + " END ****\n");
	}
52766
public boolean assignParsedElement(Instance parsedInstance, String syntaxElementName, ISyntaxElement syntaxElement) throws ModelException
    {
        if (syntaxElementName.equalsIgnoreCase(XMLSyntax.URI()) && syntaxElement instanceof SemanticIdentifier)
        {
            parsedInstance.setSemanticIdentifier((SemanticIdentifier) syntaxElement);
            return true;
        }
        if (syntaxElementName.equalsIgnoreCase(XMLSyntax.ONTOLOGY()))
        {
            if (syntaxElement instanceof SemanticIdentifier)
            {
                parsedInstance.setOntology(bsdlRegistry, (SemanticIdentifier) syntaxElement);
            }
            return true;
        }
        if (syntaxElementName.equalsIgnoreCase(XMLSyntax.CONCEPT_OF_INSTANCE_URI()) && syntaxElement instanceof SemanticIdentifier)
        {
            parsedInstance.setConcept(bsdlRegistry, (SemanticIdentifier) syntaxElement);
            return true;
        }
        if (syntaxElementName.equalsIgnoreCase(XMLSyntax.PROPERTY_VALUE()) && syntaxElement instanceof PropertyValue)
        {
            ((PropertyValue) syntaxElement).setOntology(parsedInstance.getOntology());
            parsedInstance.addProperty(((PropertyValue) syntaxElement));
            return true;
        }
        if (syntaxElementName.equalsIgnoreCase(XMLSyntax.IMPORT()) && syntaxElement instanceof Import)
        {
            parsedInstance.imports().add((Import) syntaxElement);
            return true;
        }
        return false;
    }
397121
private void indexSupertypes(TypeElement rootElement, TypeElement element) throws IOException {

		for (TypeMirror mirror : types.directSupertypes(element.asType())) {
			if (mirror.getKind() != TypeKind.DECLARED) {
				continue;
			}

			DeclaredType superType = (DeclaredType) mirror;
			TypeElement superTypeElement = (TypeElement) superType.asElement();
			storeSubclass(superTypeElement, rootElement);

			for (AnnotationMirror annotationMirror : superTypeElement.getAnnotationMirrors()) {
				TypeElement annotationElement = (TypeElement) annotationMirror.getAnnotationType()
						.asElement();

				if (hasAnnotation(annotationElement, Inherited.class)) {
					storeAnnotation(annotationElement, rootElement);
				}
			}

			indexSupertypes(rootElement, superTypeElement);
		}
	}
1116437
static boolean isClassType(Element element, Elements elements, Types types) {
    TypeMirror classType = types.getDeclaredType(
        elements.getTypeElement(Class.class.getName()),
        types.getWildcardType(null, null));
    return types.isAssignable(element.asType(), classType);
  }
931794
public void register(String table, String column, Class<?> javaType) {
        register(table, column, javaTypeMapping.getType(javaType));
    }
1243924
private void registerXmlSchemaRepository(Element element, ParserContext parserContext) {
        BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(XsdSchemaRepository.class);
        BeanDefinitionParserUtils.setPropertyReference(builder, element.getAttribute("schema-mapping-strategy"), "schemaMappingStrategy");
        addLocationsToBuilder(element, builder);
        parseSchemasElement(element, builder, parserContext);
        parserContext.getRegistry().registerBeanDefinition(element.getAttribute(ID), builder.getBeanDefinition());
    }
1117520
public boolean assignParsedElement(Multiplicity parsedMultiplicity, String syntaxElementName, ISyntaxElement syntaxElement) throws ModelException {
        if (syntaxElementName.equalsIgnoreCase(XMLSyntax.MULTIPLICITY_MIN()) && syntaxElement instanceof SimpleProperty) {
            if (((SimpleProperty) syntaxElement).getValue().toString().equalsIgnoreCase("*")) {
                parsedMultiplicity.setMin(null);
            } else {
                parsedMultiplicity.setMin(Integer.parseInt(((SimpleProperty) syntaxElement).getValue().toString()));
            }
            return true;
        }
        if (syntaxElementName.equalsIgnoreCase(XMLSyntax.MULTIPLICITY_MAX()) && syntaxElement instanceof SimpleProperty) {
            if (((SimpleProperty) syntaxElement).getValue().toString().equalsIgnoreCase("*")) {
                parsedMultiplicity.setMax(null);
            } else {
                parsedMultiplicity.setMax(Integer.parseInt(((SimpleProperty) syntaxElement).getValue().toString()));
            }
            return true;
        }
        return false;
    }
1130638
public void setInstanceTypeConfigs(java.util.Collection<InstanceTypeConfig> instanceTypeConfigs) {
        if (instanceTypeConfigs == null) {
            this.instanceTypeConfigs = null;
            return;
        }

        this.instanceTypeConfigs = new com.amazonaws.internal.SdkInternalList<InstanceTypeConfig>(instanceTypeConfigs);
    }
185153
public void registerPrototype(String name, Class<?> clazz) throws BeansException {
        GenericBeanDefinition bd = new GenericBeanDefinition();
        bd.setScope(GenericBeanDefinition.SCOPE_PROTOTYPE);
        bd.setBeanClass(clazz);
        getDefaultListableBeanFactory().registerBeanDefinition(name, bd);
    }
256
TypeElement superClassFor(TypeElement element) {
        TypeMirror superclass = element.getSuperclass();
        if (superclass.getKind() == TypeKind.NONE) {
            return null;
        }
        DeclaredType kind = (DeclaredType) superclass;
        return (TypeElement) kind.asElement();
    }
134916
protected void createGenModelAnnotations()
	{
		String source = "http://www.eclipse.org/emf/2002/GenModel";	
		addAnnotation
		  (jvmIdentifiableElementEClass.getEOperations().get(0), 
		   source, 
		   new String[] 
		   {
			 "documentation", "<p>The identifier of a JvmIdentifiableElement is a canonical representation of the element.</p>\n<p>A type will return its fully qualified name as its identifier with a \'$\' delimiter for inner classes. \nThe identifier of an executables contains the identifiers of their respective parameter types. They do\nnot contain any information about type parameters.</p>\n<p>Examples for identifiers are:</p>\n<ul>\n<li>java.lang.String for a class</li>\n<li>java.util.Map$Entry for an inner class</li>\n<li>java.lang.String.String() for a constructor (note the repeated simple name)</li>\n<li>java.lang.String.charAt(int) for a method</li>\n<li>java.lang.String.offset for a field</li>\n<li>java.lang.Object[][] for an array type</li>\n</ul>"
		   });	
		addAnnotation
		  (jvmIdentifiableElementEClass.getEOperations().get(1), 
		   source, 
		   new String[] 
		   {
			 "documentation", "<p>The simple name of a JvmIdentifiableElement is short representation of the element.</p>\n<p>The simple name does not contain any information about type parameters.</p>\n<p>Examples for simple names are:</p>\n<ul>\n<li>String for class java.lang.String</li>\n<li>Entry for class java.util.Map$Entry</li>\n<li>charAt for method java.lang.String.charAt(int)</li>\n<li>String for constructor java.lang.String.String(java.lang.String)</li>\n</ul>"
		   });	
		addAnnotation
		  (jvmIdentifiableElementEClass.getEOperations().get(2), 
		   source, 
		   new String[] 
		   {
			 "documentation", "<p>The qualified name of a JvmIdentifiableElement is a textual representation of the element.</p>\n<p>The default delimiter character is the \'$\'.</p>\n@see #getQualifiedName(char)"
		   });	
		addAnnotation
		  (jvmIdentifiableElementEClass.getEOperations().get(3), 
		   source, 
		   new String[] 
		   {
			 "documentation", "<p>The qualified name of a JvmIdentifiableElement is a textual representation of the element.</p>\n<p>The name does not contain any information about type parameters. Inner classes are delimited by means of \nthe given \'innerClassDelimiter\'</p>\n<p>Examples for qualified names with a \'$\' delimiter are:</p>\n<ul>\n<li>java.lang.String for class java.lang.String</li>\n<li>java.util.Map$Entry for class java.util.Map$Entry</li>\n<li>java.lang.String.charAt for method java.lang.String.charAt(int)</li>\n<li>java.lang.String.offset for field java.lang.String.offset</li>\n<li>java.lang.String for a constructor that is identified by java.lang.String.String(java.lang.String)</li>\n</ul>"
		   });	
		addAnnotation
		  (jvmDeclaredTypeEClass.getEOperations().get(2), 
		   source, 
		   new String[] 
		   {
			 "documentation", "<p>Returns all the fields and operations with the given simple name.</p>\n<p>Inherited features will be returend, but overridden features are not contained in the result.</p>"
		   });	
		addAnnotation
		  (jvmDeclaredTypeEClass.getEOperations().get(3), 
		   source, 
		   new String[] 
		   {
			 "documentation", "<p>Returns all the fields and operations of this type.</p>\n<p>Inherited features are included, but overridden features will not be returned.</p>"
		   });	
		addAnnotation
		  (jvmDeclaredTypeEClass.getEOperations().get(7), 
		   source, 
		   new String[] 
		   {
			 "documentation", "<p>Returns all the nested types with the given simple name.</p>\n<p>Inherited types will be returned, too.</p>"
		   });	
		addAnnotation
		  (jvmDeclaredTypeEClass.getEOperations().get(10), 
		   source, 
		   new String[] 
		   {
			 "documentation", "<p>Returns all the nested types of this type.</p>\n<p>Inherited types will also be returned.</p>"
		   });	
		addAnnotation
		  (jvmTypeConstraintEClass.getEOperations().get(0), 
		   source, 
		   new String[] 
		   {
			 "documentation", "<p>The identifier of a JvmTypeConstraint is a canonical representation of the constraint information.</p>\n<p>Examples for constraint identifiers are:</p>\n<ul>\n<li>extends java.util.List<java.lang.Map$Entry<java.lang.Object,java.lang.Object>></li>\n<li>super java.lang.Object</li>\n</ul>"
		   });	
		addAnnotation
		  (jvmTypeReferenceEClass.getEOperations().get(1), 
		   source, 
		   new String[] 
		   {
			 "documentation", "<p>The identifier of a JvmTypeReference is a canonical representation of the referenced type \nincluding its type arguments.</p>\n<p>The types fully qualified name is used (\'$\' is the delimiter for inner types).</p>\n<p>Examples for reference identifiers are:</p>\n<ul>\n<li>java.lang.String for a reference to an object type</li>\n<li>java.util.Map$Entry<java.lang.Object,java.lang.Integer> for a parameterized type</li>\n<li>java.util.List<? extends java.lang.String>[] for a generic array type</li>\n</ul>"
		   });	
		addAnnotation
		  (jvmFeatureEClass.getEOperations().get(0), 
		   source, 
		   new String[] 
		   {
			 "documentation", "<p>Returns <code>true</code> if the feature is a static field or static operation.</p>\n\n@since 2.4"
		   });	
		addAnnotation
		  (getJvmOperation_DefaultValue(), 
		   source, 
		   new String[] 
		   {
			 "documentation", "<p>Returns the default value for the annotation member represented by this JvmOperation instance.</p>\n<p>Returns null if no default is associated with the member, or if the operation does not represent a declared member of an annotation type.</p>"
		   });	
		addAnnotation
		  (jvmAnnotationReferenceEClass.getEOperations().get(0), 
		   source, 
		   new String[] 
		   {
			 "documentation", "<p>Returns all annotation values. That is, default values are not included if not explicitely given.</p>"
		   });	
		addAnnotation
		  (getJvmAnnotationReference_ExplicitValues(), 
		   source, 
		   new String[] 
		   {
			 "documentation", "<p>Returns the explicit annotation values. That is, default values are not expected to be contained in that list.</p>\n<p>Important note: Some implementations don\'t have enough information about default values on annotations.\nThey may choose to consider all available values as explicit values.</p>"
		   });	
		addAnnotation
		  (jvmAnnotationValueEClass, 
		   source, 
		   new String[] 
		   {
			 "documentation", "<p>Represents the value of an annotation member.</p>\n<p>That is, either the default value of an operation as a member of an annotation type, or the \nconcrete value in an annotation reference is returned.</p>"
		   });	
		addAnnotation
		  (getJvmUnknownTypeReference_QualifiedName(), 
		   source, 
		   new String[] 
		   {
			 "documentation", "<p>Returns the known qualified name of the otherwise unresolveable type. May be <code>null</code>.</p>\n\n@since 2.4"
		   });
	}
1362785
public ChainingXmlWriter register(String parameterName, ICalDataType dataType) {
		parameterDataTypes.put(parameterName, dataType);
		return this;
	}
682485
public void setElementType (Class type, String fieldName, Class elementType) {
		ObjectMap<String, FieldMetadata> fields = getFields(type);
		FieldMetadata metadata = fields.get(fieldName);
		if (metadata == null) throw new JsonException("Field not found: " + fieldName + " (" + type.getName() + ")");
		metadata.elementType = elementType;
	}
14439
void registerTypeImplementingInterface(
      FunctionType type, ObjectType interfaceInstance) {
    interfaceToImplementors.put(interfaceInstance.getReferenceName(), type);
  }
246460
public void register(T instance) {
		if(!isContained(instance)) {
			registry.add(instance);
			if(current == null) {
				current = instance;
			}
		}
	}
1330695
protected final void registerModelBuilder(RestApiContext context, ModelBuilder mbProto, int version) {
    Class<? extends water.api.Handler> handlerClass = water.api.ModelBuilderHandler.class;
    if (H2O.ARGS.features_level.compareTo(mbProto.builderVisibility()) > 0) {
      return; // Skip endpoint registration
    }
    String base = mbProto.getClass().getSimpleName();
    String lbase = base.toLowerCase();
    // This is common model builder handler

    context.registerEndpoint(
        "train_" + lbase,
        "POST /" + version + "/ModelBuilders/" + lbase,
        handlerClass,
        "train",
        "Train a " + base + " model."
    );

    context.registerEndpoint(
        "validate_" + lbase,
        "POST /" + version + "/ModelBuilders/" + lbase + "/parameters",
        handlerClass,
        "validate_parameters",
        "Validate a set of " + base + " model builder parameters."
    );

    // Grid search is experimental feature
    context.registerEndpoint(
        "grid_search_" + lbase,
        "POST /99/Grid/" + lbase,
        GridSearchHandler.class,
        "train",
        "Run grid search for " + base + " model."
    );
  }