public static <A extends Alias> A newAliasInstanceFor(Class<? extends AnnotatedObject> aoClass) { Class<A> aliasClass = (Class<A>) AnnotatedObjectUtils.getAliasClassType(aoClass); return ClassUtils.newInstance(aliasClass); } }
public static <A extends Alias> A newAliasInstanceFor(Class<? extends AnnotatedObject> aoClass) { Class<A> aliasClass = (Class<A>) AnnotatedObjectUtils.getAliasClassType(aoClass); return ClassUtils.newInstance(aliasClass); } }
public static <A extends Alias> A newAliasInstanceFor(Class<? extends AnnotatedObject> aoClass) { Class<A> aliasClass = (Class<A>) AnnotatedObjectUtils.getAliasClassType(aoClass); return ClassUtils.newInstance(aliasClass); } }
public CvObjectConverter(Institution institution, Class<C> intactCvClass, Class<T> psiCvClass) { super(institution); this.intactCvClass = intactCvClass; this.psiCvClass = psiCvClass; Class<?> aliasClass = AnnotatedObjectUtils.getAliasClassType(intactCvClass); Class<?> xrefClass = AnnotatedObjectUtils.getXrefClassType(intactCvClass); this.aliasConverter = new AliasConverter(institution, aliasClass); this.xrefConverter = new XrefConverter(institution, xrefClass); }
public AbstractAnnotatedObjectConverter(Institution institution, Class<? extends A> intactClass, Class<T> psiClass) { super(institution); this.intactClass = intactClass; this.psiClass = psiClass; Class<?> aliasClass = AnnotatedObjectUtils.getAliasClassType(intactClass); Class<?> xrefClass = AnnotatedObjectUtils.getXrefClassType(intactClass); this.annotationConverter = new AnnotationConverter(institution); this.aliasConverter = new AliasConverter(institution, aliasClass); this.xrefConverter = new XrefConverter(institution, xrefClass); }
public static void populateNames(Names names, AnnotatedObject<?, ?> annotatedObject) { String shortLabel = getShortLabelFromNames(names); if (names == null && (annotatedObject instanceof Experiment) ) { shortLabel = createExperimentTempShortLabel(); } if ( ! ( annotatedObject instanceof Institution ) ) { if ( shortLabel != null ) { shortLabel = shortLabel.toLowerCase(); } } annotatedObject.setShortLabel(shortLabel); if (names != null) { annotatedObject.setFullName(names.getFullName()); Class<?> aliasClass = AnnotatedObjectUtils.getAliasClassType(annotatedObject.getClass()); AliasConverter aliasConverter = new AliasConverter(getInstitution(annotatedObject), aliasClass); populateAliases(names.getAliases(), annotatedObject, aliasConverter); } }
public static void populateNames(Names names, AnnotatedObject<?, ?> annotatedObject, AliasConverter aliasConverter) { String shortLabel = getShortLabelFromNames(names); if (names == null && (annotatedObject instanceof Experiment) ) { shortLabel = createExperimentTempShortLabel(); } if ( ! ( annotatedObject instanceof Institution ) ) { if ( shortLabel != null ) { shortLabel = shortLabel.toLowerCase(); } } annotatedObject.setShortLabel(shortLabel); if (names != null) { annotatedObject.setFullName(names.getFullName()); if (aliasConverter == null){ Class<?> aliasClass = AnnotatedObjectUtils.getAliasClassType(annotatedObject.getClass()); aliasConverter = new AliasConverter(getInstitution(annotatedObject), aliasClass); } populateAliases(names.getAliases(), annotatedObject, aliasConverter); } }
/** * Retrieves the aliases from an AnnotatedObject, initializing them if necessary. * * @param ao The annotated object instance with possibly non-initialized aliases * @return The returned aliases are ensured to be initialized * @since 2.4.0 */ public static Collection<? extends Alias> ensureInitializedAliases(AnnotatedObject<?, ?> ao) { Collection<? extends Alias> aliases; if (IntactCore.isInitialized(ao.getAliases())) { aliases = ao.getAliases(); } else { aliases = IntactContext.getCurrentInstance().getDaoFactory().getAliasDao(AnnotatedObjectUtils.getAliasClassType(ao.getClass())) .getByParentAc(ao.getAc()); } return aliases; }
/** * Retrieves the aliases from an AnnotatedObject, initializing them if necessary. * * @param ao The annotated object instance with possibly non-initialized aliases * @return The returned aliases are ensured to be initialized * @since 2.4.0 */ public static Collection<? extends Alias> ensureInitializedAliases(AnnotatedObject<?, ?> ao) { Collection<? extends Alias> aliases; if (IntactCore.isInitialized(ao.getAliases())) { aliases = ao.getAliases(); } else { aliases = IntactContext.getCurrentInstance().getDaoFactory().getAliasDao(AnnotatedObjectUtils.getAliasClassType(ao.getClass())) .getByParentAc(ao.getAc()); } return aliases; }
protected static void populateNames( AnnotatedObject<?, ?> annotatedObject, NamesContainer namesContainer ) { Names names = namesContainer.getNames(); if ( names == null ) { names = new Names(); } String shortLabel = annotatedObject.getShortLabel(); String fullName = annotatedObject.getFullName(); names.setShortLabel( shortLabel ); names.setFullName( fullName ); if ( !ConverterContext.getInstance().getInteractorConfig().isExcludeInteractorAliases() ) { AliasConverter aliasConverter = new AliasConverter( annotatedObject.getOwner(), AnnotatedObjectUtils.getAliasClassType( annotatedObject.getClass() ) ); for ( Alias alias : IntactCore.ensureInitializedAliases(annotatedObject)) { names.getAliases().add( aliasConverter.intactToPsi( alias ) ); } } namesContainer.setNames( names ); }