コード例 #1
0
        private IFacet GetNamedFacet(ISpecification holder, INamedFacet facet, IIdentifier identifier)
        {
            var    spec     = holder as IActionParameterSpec;
            string i18NName = spec == null?GetName(identifier) : GetParameterName(identifier, spec.Number);

            return(i18NName == null ? null : new NamedFacetI18N(i18NName, facet.Specification));
        }
コード例 #2
0
        public NamedFacetDynamicWrapI18n(II18nManager manager, IFacetHolder holder, IIdentifier identifier, INamedFacet namedFacet, int index = -1)
            : base(Type, holder) {
            this.manager = manager;
            this.identifier = identifier;
            this.namedFacet = namedFacet;

            this.index = index;
        }
コード例 #3
0
        public override void ProcessParams(IReflector reflector, MethodInfo method, int paramNum, ISpecificationBuilder holder)
        {
            var facets = new List <IFacet>();

            var param = holder as ActionParameterSpecImmutable;

            if (param != null)
            {
                string      name       = method.GetParameters()[paramNum].Name;
                INamedFacet namedFacet = name == null ? (INamedFacet) new NamedFacetNone(holder) : new NamedFacetInferred(NameUtils.NaturalName(name), holder);
                facets.Add(namedFacet);
                facets.Add(new DescribedAsFacetNone(holder));
                facets.Add(new MultiLineFacetNone(holder));
                facets.Add(new MaxLengthFacetZero(holder));
                facets.Add(new TypicalLengthFacetZero(holder));
                DefaultTypicalLength(facets, param.Specification, param);
            }

            FacetUtils.AddFacets(facets);
        }
コード例 #4
0
        private IFacet GetNamedFacet(IFacetHolder holder, INamedFacet facet, IIdentifier identifier) {
            string original = (facet).Value ?? NameUtils.NaturalName(identifier.MemberName);
            string i18nName;
            if (holder is NakedObjectActionParameterAbstract) {
                int index = ((NakedObjectActionParameterAbstract) holder).Number;
                i18nName = i18nManager.GetParameterName(identifier, index, original);

                if (!staticFacets) {
                    return new NamedFacetDynamicWrapI18n(i18nManager, holder, identifier, facet, index);
                }
            }
            else {
                i18nName = i18nManager.GetName(identifier, original);

                if (!staticFacets) {
                    return new NamedFacetDynamicWrapI18n(i18nManager, holder, identifier, facet);
                }
            }
            return i18nName == null ? null : new NamedFacetWrapI18n(i18nName, facet.FacetHolder);
        }
コード例 #5
0
 private IFacet GetNamedFacet(ISpecification holder, INamedFacet facet, IIdentifier identifier) {
     var spec = holder as IActionParameterSpec;
     string i18NName = spec == null ? GetName(identifier) : GetParameterName(identifier, spec.Number);
     return i18NName == null ? null : new NamedFacetI18N(i18NName, facet.Specification);
 }