private static AllowedValue[] getAllowedValues(TypeDescription type) { AllowedValue[] r = type.getAllowedValues(); if (r == null) { return new AllowedValue[0]; } return r; }
/** * Gets the allowed value. * * @param value the value * @param td the td * @return the allowed value */ public AllowedValue getAllowedValue(String value, TypeDescription td) { AllowedValue[] avs = td.getAllowedValues(); if (null == avs) return null; for (int i = 0; i < avs.length; i++) { if (value.equals(avs[i].getString())) return avs[i]; } return null; }
/** * Removes the allowed value. * * @param td - * local or merged (2 callers) * @param av the av */ private void removeAllowedValue(TypeDescription td, AllowedValue av) { td.setAllowedValues((AllowedValue[]) Utility.removeEqualElementFromArray(td.getAllowedValues(), av, AllowedValue.class)); }
/** * Adds the allowed value. * * @param td the td * @param av the av */ private void addAllowedValue(TypeDescription td, AllowedValue av) { td.setAllowedValues((AllowedValue[]) Utility.addElementToArray(td.getAllowedValues(), av, AllowedValue.class)); }
/** * Checks if is local allowed value. * * @param avString the av string * @param td the td * @return true, if is local allowed value */ protected boolean isLocalAllowedValue(String avString, TypeDescription td) { TypeDescription localTd = getLocalTypeDefinition(td); if (null == localTd) return false; return Utility.arrayContains(localTd.getAllowedValues(), avString); }
if (null != existingTd) { hasFeatures = ((null != existingTd.getFeatures()) && (existingTd.getFeatures().length > 0)); hasAllowedValues = ((null != existingTd.getAllowedValues()) && (existingTd.getAllowedValues().length > 0)); if (hasAllowedValues) { result.add(CAS.TYPE_NAME_STRING);
AllowedValue[] vals = curTypeDesc.getAllowedValues(); if (vals == null) { throw new ResourceInitializationException( if (curTypeDesc.getAllowedValues() != null && curTypeDesc.getAllowedValues().length > 0) { throw new ResourceInitializationException( ResourceInitializationException.ALLOWED_VALUES_ON_NON_STRING_TYPE,
existingType.setDescription(type.getDescription()); existingType.setSupertypeName(supertypeName); existingType.setAllowedValues(type.getAllowedValues()); existingType.setSourceUrl(type.getSourceUrl()); typeNameMap.put(type.getName(), existingType);
addAllowedValue(localTd, av); if (!Utility.arrayContains(td.getAllowedValues(), av)) addAllowedValue(td, (AllowedValue) av.clone()); else
AllowedValue[] avs = td.getAllowedValues(); if (null != avs) { for (int i = 0; i < avs.length; i++) {