Project

General

Profile

« Previous | Next » 

Revision 772c2fdb

Added by Andreas Müller over 3 years ago

improve generics for TypeDesignationSetManager TypedEntityReference

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/name/TypeDesignationSetManager.java
159 159
     * @param containgEntity
160 160
     * @param typeDesignations
161 161
     */
162
    public void addTypeDesigations(CdmBase containgEntity, TypeDesignationBase ... typeDesignations){
162
    public void addTypeDesigations(CdmBase containgEntity, TypeDesignationBase<?> ... typeDesignations){
163 163
        for (TypeDesignationBase<?> typeDes: typeDesignations){
164 164
            this.typeDesignations.put(typeDes.getUuid(), typeDes);
165 165
        }
......
186 186

  
187 187
        try {
188 188
            final VersionableEntity baseEntity = baseEntity(td);
189
            final TypedEntityReference<VersionableEntity> baseEntityReference = makeEntityReference(baseEntity);
189
            final TypedEntityReference<? extends VersionableEntity> baseEntityReference = makeEntityReference(baseEntity);
190 190

  
191 191
            TypedEntityReference<?> typeDesignationEntityReference = new TypedEntityReference<>(
192 192
                    HibernateProxyHelper.deproxy(td).getClass(),
......
228 228
        return baseEntity;
229 229
    }
230 230

  
231
    /**
232
     * @param td
233
     * @return
234
     */
235
    protected TypedEntityReference<VersionableEntity> makeEntityReference(VersionableEntity baseEntity) {
231
    protected TypedEntityReference<? extends VersionableEntity> makeEntityReference(VersionableEntity baseEntity) {
236 232

  
237 233
        baseEntity = (VersionableEntity) HibernateHelper.unproxy(baseEntity);
238 234
        String label = "";
......
240 236
                label = ((FieldUnit)baseEntity).getTitleCache();
241 237
        }
242 238

  
243
        TypedEntityReference<VersionableEntity> baseEntityReference = new TypedEntityReference(baseEntity.getClass(), baseEntity.getUuid(), label);
239
        TypedEntityReference<? extends VersionableEntity> baseEntityReference =
240
                new TypedEntityReference<>((Class<? extends VersionableEntity>)baseEntity.getClass(), baseEntity.getUuid(), label);
244 241

  
245 242
        return baseEntityReference;
246 243
    }
......
776 773

  
777 774
        private String workingSetRepresentation = null;
778 775

  
779
        TypedEntityReference<VersionableEntity> baseEntityReference;
776
        private TypedEntityReference<? extends VersionableEntity> baseEntityReference;
780 777

  
781 778
        private VersionableEntity baseEntity;
782 779

  
783 780
        private List<DerivedUnit> derivedUnits = null;
784 781

  
785
        /**
786
         * @param baseEntityReference
787
         */
788
        public TypeDesignationWorkingSet(VersionableEntity baseEntity, TypedEntityReference<VersionableEntity> baseEntityReference) {
782
        public TypeDesignationWorkingSet(VersionableEntity baseEntity, TypedEntityReference<? extends VersionableEntity> baseEntityReference) {
789 783
            this.baseEntity = baseEntity;
790 784
            this.baseEntityReference = baseEntityReference;
791 785
        }
......
825 819
         *
826 820
         * @return the baseEntityReference
827 821
         */
828
        public TypedEntityReference<VersionableEntity> getBaseEntityReference() {
822
        public TypedEntityReference<? extends VersionableEntity> getBaseEntityReference() {
829 823
            return baseEntityReference;
830 824
        }
831 825

  

Also available in: Unified diff