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 class
XdtoUtil.FacetKind
XdtoValueType
facet 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 QName
createQName(String name, String nsUri)
CreatesQName
static boolean
dependencyContains(Package xdtoPackage, String nsUri)
Checks that package contains the dependency in import sectionstatic String
getExpandName(QName qname)
Gets expand presentation ofQName
: "{nsUri} localName"static String
getExpandName(String nsUri, String localName)
Gets expand presentation by nsUri and local name: "{nsUri} localName"static String
getFacetName(XdtoUtil.FacetKind facetKind)
Gets facet kind namestatic List<XdtoUtil.FacetKind>
getFacetsKind(ValueType type)
Gets all set facet ofValueType
static QName
getItemType(QName qname, org.eclipse.xtext.scoping.IScope scope, XdtoAdditionalIndexInformationHelper indexHelper)
Gets item type ofType
corresponding to theqname
static List<QName>
getMemberTypes(QName qname, org.eclipse.xtext.scoping.IScope scope, XdtoAdditionalIndexInformationHelper indexHelper)
Gets merger types ofType
corresponding to theqname
static String
getName(org.eclipse.emf.ecore.EObject eObject)
Gets package model element e-object name.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
static String
getPropertyName(Property property)
static String
getPropertyPresentation(Property property)
Gets string presentation ofProperty
: localName$Name$Form$ns uristatic boolean
isAnonymousType(QName typeName)
Checks that type corresponding to theQName
is anonymousstatic boolean
isDescendant(QName type, QName childType, org.eclipse.xtext.scoping.IScope allTypes, org.eclipse.xtext.naming.IQualifiedNameProvider qualifiedNameProvider, XdtoAdditionalIndexInformationHelper additionalIndexInformationHelper)
Checks thattype
is descendant forchildType
.static boolean
isEmptyQName(QName qname)
Checks thatQName
is emptystatic boolean
isEquals(Type type, QName qname)
Checks thatqname
link to thetype
static boolean
isFacetAvailable(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 theQName
is anonymous- Parameters:
typeName
- checking type, can't benull
- Returns:
true
if type corresponding to theQName
is anonymous,false
otherwise
-
dependencyContains
public static boolean dependencyContains(Package xdtoPackage, String nsUri)
Checks that package contains the dependency in import section- Parameters:
xdtoPackage
-Package
checking package, can't benull
nsUri
- looking up dependency uri- Returns:
true
if dependency was found,false
otherwise
-
getItemType
public static QName getItemType(QName qname, org.eclipse.xtext.scoping.IScope scope, XdtoAdditionalIndexInformationHelper indexHelper)
Gets item type ofType
corresponding to theqname
- Parameters:
qname
-QName
of theType
, can't benull
scope
-IScope
contains all xdto types, can't benull
indexHelper
-XdtoAdditionalIndexInformationHelper
for getting item type, can't benull
- Returns:
QName
corresponding to the item type ofqname
type, ornull
if it doesn't have it
-
isEmptyQName
public static boolean isEmptyQName(QName qname)
Checks thatQName
is empty- Parameters:
qname
- checkingQName
- Returns:
true
ifqname
isnull
orQName.getName()
orQName.getNsUri()
isnull
or empty
-
getMemberTypes
public static List<QName> getMemberTypes(QName qname, org.eclipse.xtext.scoping.IScope scope, XdtoAdditionalIndexInformationHelper indexHelper)
Gets merger types ofType
corresponding to theqname
- Parameters:
qname
-QName
of theType
, can't benull
scope
-IScope
contains all xdto types, can't benull
indexHelper
-XdtoAdditionalIndexInformationHelper
for getting merger types, can't benull
- Returns:
- list of
QName
corresponding to the merger types ofqname
type, 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 benull
localName
- 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 thattype
is descendant forchildType
. Step by step comparetype
and 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
-Type
for getting it primitive type, can't benull
allTypes
-IScope
of all available xdtoType
s, can't benull
qualifiedNameProvider
- actualIQualifiedNameProvider
for xdto, can't benull
version
- actual project version, can't benull
- Returns:
- found primitive type or
null
if 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 benull
facetKind
- type of facet, can't benull
- Returns:
true
if value of facet kind can be set,false
otherwise
-
getPropertyName
public static String getPropertyName(Property property)
- Parameters:
property
-Property
for getting name, can't benull
- Returns:
- actual
Property
name: ifProperty.getName()
isnull
or empty return name of reference property. Can benull
if 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
null
if not supported
-
-