Package com._1c.g5.v8.dt.xdto.util
Class XdtoUtil
- java.lang.Object
-
- com._1c.g5.v8.dt.xdto.util.XdtoUtil
-
public final class XdtoUtil extends Object
Useful method for working with xdto package elements
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classXdtoUtil.FacetKindXdtoValueTypefacet kinds
-
Field Summary
Fields Modifier and Type Field Description static Set<String>PRIMITIVE_TYPE_NAMES
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static QNamecreateQName(String name, String nsUri)CreatesQNamestatic booleandependencyContains(Package xdtoPackage, String nsUri)Checks that package contains the dependency in import sectionstatic StringgetExpandName(QName qname)Gets expand presentation ofQName: "{nsUri} localName"static StringgetExpandName(String nsUri, String localName)Gets expand presentation by nsUri and local name: "{nsUri} localName"static StringgetFacetName(XdtoUtil.FacetKind facetKind)Gets facet kind namestatic List<XdtoUtil.FacetKind>getFacetsKind(ValueType type)Gets all set facet ofValueTypestatic QNamegetItemType(QName qname, org.eclipse.xtext.scoping.IScope scope, XdtoAdditionalIndexInformationHelper indexHelper)Gets item type ofTypecorresponding to theqnamestatic List<QName>getMemberTypes(QName qname, org.eclipse.xtext.scoping.IScope scope, XdtoAdditionalIndexInformationHelper indexHelper)Gets merger types ofTypecorresponding to theqnamestatic StringgetName(org.eclipse.emf.ecore.EObject eObject)Gets package model element e-object name.static TypegetPrimitiveType(Type type, org.eclipse.xtext.scoping.IScope allTypes, org.eclipse.xtext.naming.IQualifiedNameProvider qualifiedNameProvider, Version version)Gets primitive xdto type corresponding to thetypestatic StringgetPropertyName(Property property)static StringgetPropertyPresentation(Property property)Gets string presentation ofProperty: localName$Name$Form$ns uristatic booleanisAnonymousType(QName typeName)Checks that type corresponding to theQNameis anonymousstatic booleanisDescendant(QName type, QName childType, org.eclipse.xtext.scoping.IScope allTypes, org.eclipse.xtext.naming.IQualifiedNameProvider qualifiedNameProvider, XdtoAdditionalIndexInformationHelper additionalIndexInformationHelper)Checks thattypeis descendant forchildType.static booleanisEmptyQName(QName qname)Checks thatQNameis emptystatic booleanisEquals(Type type, QName qname)Checks thatqnamelink to thetypestatic booleanisFacetAvailable(Type primitiveType, XdtoUtil.FacetKind facetKind)Checks that facet of primitive type can be fill
-
-
-
Method Detail
-
isAnonymousType
public static boolean isAnonymousType(QName typeName)
Checks that type corresponding to theQNameis anonymous- Parameters:
typeName- checking type, can't benull- Returns:
trueif type corresponding to theQNameis anonymous,falseotherwise
-
dependencyContains
public static boolean dependencyContains(Package xdtoPackage, String nsUri)
Checks that package contains the dependency in import section- Parameters:
xdtoPackage-Packagechecking package, can't benullnsUri- looking up dependency uri- Returns:
trueif dependency was found,falseotherwise
-
getItemType
public static QName getItemType(QName qname, org.eclipse.xtext.scoping.IScope scope, XdtoAdditionalIndexInformationHelper indexHelper)
Gets item type ofTypecorresponding to theqname- Parameters:
qname-QNameof theType, can't benullscope-IScopecontains all xdto types, can't benullindexHelper-XdtoAdditionalIndexInformationHelperfor getting item type, can't benull- Returns:
QNamecorresponding to the item type ofqnametype, ornullif it doesn't have it
-
isEmptyQName
public static boolean isEmptyQName(QName qname)
Checks thatQNameis empty- Parameters:
qname- checkingQName- Returns:
trueifqnameisnullorQName.getName()orQName.getNsUri()isnullor empty
-
getMemberTypes
public static List<QName> getMemberTypes(QName qname, org.eclipse.xtext.scoping.IScope scope, XdtoAdditionalIndexInformationHelper indexHelper)
Gets merger types ofTypecorresponding to theqname- Parameters:
qname-QNameof theType, can't benullscope-IScopecontains all xdto types, can't benullindexHelper-XdtoAdditionalIndexInformationHelperfor getting merger types, can't benull- Returns:
- list of
QNamecorresponding to the merger types ofqnametype, or empty list if it doesn't have it
-
getExpandName
public static String getExpandName(QName qname)
Gets expand presentation ofQName: "{nsUri} localName"
-
getExpandName
public static String getExpandName(String nsUri, String localName)
Gets expand presentation by nsUri and local name: "{nsUri} localName"- Parameters:
nsUri- actual uri for getting expand presentation, can't benulllocalName- actual local name for getting expand presentation, can't benull- Returns:
- expand presentation by nsUri and local name, never
null
-
getPropertyPresentation
public static String getPropertyPresentation(Property property)
Gets string presentation ofProperty: localName$Name$Form$ns uri
-
isDescendant
public static boolean isDescendant(QName type, QName childType, org.eclipse.xtext.scoping.IScope allTypes, org.eclipse.xtext.naming.IQualifiedNameProvider qualifiedNameProvider, XdtoAdditionalIndexInformationHelper additionalIndexInformationHelper)
Checks thattypeis descendant forchildType. Step by step comparetypeand base types ofchildType
-
getPrimitiveType
public static Type getPrimitiveType(Type type, org.eclipse.xtext.scoping.IScope allTypes, org.eclipse.xtext.naming.IQualifiedNameProvider qualifiedNameProvider, Version version)
Gets primitive xdto type corresponding to thetype- Parameters:
type-Typefor getting it primitive type, can't benullallTypes-IScopeof all available xdtoTypes, can't benullqualifiedNameProvider- actualIQualifiedNameProviderfor xdto, can't benullversion- actual project version, can't benull- Returns:
- found primitive type or
nullif it wasn't found
-
getFacetsKind
public static List<XdtoUtil.FacetKind> getFacetsKind(ValueType type)
Gets all set facet ofValueType- Parameters:
type- checkingValueType, can't benull- Returns:
- list of set
XdtoUtil.FacetKind, nevernull
-
getFacetName
public static String getFacetName(XdtoUtil.FacetKind facetKind)
Gets facet kind name- Parameters:
facetKind-XdtoUtil.FacetKind, can't benull- Returns:
- name of the
XdtoUtil.FacetKind, nevernull
-
isFacetAvailable
public static boolean isFacetAvailable(Type primitiveType, XdtoUtil.FacetKind facetKind)
Checks that facet of primitive type can be fill- Parameters:
primitiveType- checking primitive xdto type, can't benullfacetKind- type of facet, can't benull- Returns:
trueif value of facet kind can be set,falseotherwise
-
getPropertyName
public static String getPropertyName(Property property)
- Parameters:
property-Propertyfor getting name, can't benull- Returns:
- actual
Propertyname: ifProperty.getName()isnullor empty return name of reference property. Can benullif property and reference property don't have names or there is no refernce property
-
getName
public static String getName(org.eclipse.emf.ecore.EObject eObject)
Gets package model element e-object name.- Parameters:
eObject- e-object, cannot benull- Returns:
- object name or
nullif not supported
-
-