Extract and replies the Ecore type, provided by {@link SarlPackage} for the given JvmElement.

@param type the JVM type to test.
@return the code of the type, see {@link SarlPackage}; or {@code 0} if the code is unknown.
@since 0.6
506986
public int getSarlElementEcoreType(JvmGenericType type) {
		final JvmAnnotationReference annotationRef = this.annotationUtil.findAnnotation(type, SarlElementType.class.getName());
		if (annotationRef != null) {
			final Integer intValue = this.annotationUtil.findIntValue(annotationRef);
			if (intValue != null) {
				return intValue.intValue();
			}
		}
		return 0;
	}
68849
protected static boolean isJsonDTO(String javaType) {
        Set<String> jsonJavatypes = new HashSet<>(Arrays.asList("org.apache.maven.archetype.catalog.Archetype"));
        return javaType != null && jsonJavatypes.contains(javaType);
    }
1065373
private String classForType(Type type) {

        switch (type) {
            case ERROR:
                return I_CmsLayoutBundle.INSTANCE.notificationCss().notificationError();
            case NORMAL:
                return I_CmsLayoutBundle.INSTANCE.notificationCss().notificationNormal();
            case WARNING:
                return I_CmsLayoutBundle.INSTANCE.notificationCss().notificationWarning();
            default:
                return I_CmsLayoutBundle.INSTANCE.notificationCss().notificationNormal();
        }
    }
802540
public static String getElementAsString(JDeclaration type) {
		StringBuilder builder = new StringBuilder();
		JFormatter jFormatter = new JFormatter(new StringBuilderWriter(builder));
		type.declare(jFormatter);
		return builder.toString();
	}
120637
public static boolean isPackageValid(final Class type) {
        boolean res = false;
        if (type != null) {
            final Package packaj = type.getPackage();
            res = !(packaj == null || packaj.getName().startsWith("java"));
        }
        return res;
    }
830188
private Content getTreeForClassHelper(Type type) {
        Content li = new HtmlTree(HtmlTag.LI);
        if (type.equals(classDoc)) {
            Content typeParameters = getTypeParameterLinks(
                    new LinkInfoImpl(configuration, LinkInfoImpl.Kind.TREE,
                    classDoc));
            if (configuration.shouldExcludeQualifier(
                    classDoc.containingPackage().name())) {
                li.addContent(type.asClassDoc().name());
                li.addContent(typeParameters);
            } else {
                li.addContent(type.asClassDoc().qualifiedName());
                li.addContent(typeParameters);
            }
        } else {
            Content link = getLink(new LinkInfoImpl(configuration,
                    LinkInfoImpl.Kind.CLASS_TREE_PARENT, type)
                    .label(configuration.getClassName(type.asClassDoc())));
            li.addContent(link);
        }
        return li;
    }
862721
public synchronized ASTType getType(final TypeElement typeElement) {
        return new LazyASTType(buildPackageClass(typeElement), typeElement) {
            @Override
            public ASTType lazyLoad() {
                if (!typeCache.containsKey(typeElement)) {
                    typeCache.put(typeElement, buildType(typeElement));
                }

                return typeCache.get(typeElement);
            }
        };
    }
1308231
public static String inferModulePathFromType(TypeDeclaration type) {
        PackageDeclaration pkg = type.getPackage();
        return pkg != null ? '/' + pkg.getQualifiedName().replace('.', '/') : "/";
    }
1179623
public Object getBodyAs(Type type) {
    if (response == null) {
      return null;
    }
    String body = response.getBody();
    if (TextUtils.isEmpty(body)) {
      return null;
    }
    try {
      return Wasp.getParser().fromBody(response.getBody(), type);
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
83474
public String createClassSignature(TypeElement type) {
    if (!hasGenericSignature(type)) {
      return null;
    }
    StringBuilder sb = new StringBuilder();
    genClassSignature(type, sb);
    return sb.toString();
  }
293726
public static String getValidType(String type)
    {
        return (validationClassMapper.get(type) == null) ? "binary" : validationClassMapper.get(type);
    }
207354
public static <E> E get(Class<E> type) {
    ServiceLoader<E> loader = ServiceLoader.load(type);
    Iterator<E> iterator = loader.iterator();
    if (iterator.hasNext()) {
      return iterator.next(); // only one is expected
    }
    try {
      //loads the default implementation
      return (E) Class.forName(getDefaultImplementationName(type)).newInstance();
    } catch (Exception e) {
      throw new TruggerException(e);
    }
  }
1165942
public Optional<MapperInstance> getSerializer( JType type ) {
        return Optional.fromNullable( serializers.get( type.getQualifiedSourceName() ) );
    }
928944
public <C> C mapTo(JavaType type) {
    JacksonJsonDataFormatMapper mapper = dataFormat.getMapper();
    return mapper.mapInternalToJava(jsonNode, type);
  }
437372
public static String arrayType( String type ) {
        if ( isArray( type ) )
            if ( type.length() == arrayDimSize(type) +1  ) {
                return type;
            } else {
                String ans = "Ljava/lang/Object;";
                for ( int j = 0; j < arrayDimSize( type ); j++ ) {
                    ans = "[" + ans;
                }
                return ans;
            }
        return null;
    }
210276
public String getLiteralType(Type type) {
		String result = "";
		if (type != null) {
			if (ParameterizedType.class.isAssignableFrom(type.getClass())) {
				ParameterizedType parameterizedType = (ParameterizedType) type;
				result = parameterizedType.toString();
			} else {
				result = ((Class) type).getCanonicalName();
			}
		}
		return result;
	}
999206
public static String getCharsetFromContentType(String type) {
    	init();
        if (type == null) {
            return null;
        }

        int semi = type.indexOf(";");

        if (semi == -1) {
            return null;
        }

        String afterSemi = type.substring(semi + 1);

        int charsetLocation = afterSemi.indexOf("charset=");

        if (charsetLocation == -1) {
            return null;
        }

        return afterSemi.substring(charsetLocation + 8).trim();
    }