Beispiel #1
0
        public override void ReflectWith(IAttributeReflector reflector)
        {
            // when wordbreaking CJK, we use the 15924 code Japanese (Han+Hiragana+Katakana) to
            // mark runs of Chinese/Japanese. our use is correct (as for chinese Han is a subset),
            // but this is just to help prevent confusion.
            string name = code == UScript.Japanese ? "Chinese/Japanese" : GetName();

            reflector.Reflect <IScriptAttribute>("script", name);
        }
Beispiel #2
0
 public override void ReflectWith(IAttributeReflector reflector)
 {
     base.ReflectWith(reflector);
     reflector.Reflect(typeof(IOffsetAttribute), "startOffset", startOffset);
     reflector.Reflect(typeof(IOffsetAttribute), "endOffset", endOffset);
     reflector.Reflect(typeof(IPositionIncrementAttribute), "positionIncrement", positionIncrement);
     reflector.Reflect(typeof(IPayloadAttribute), "payload", payload);
     reflector.Reflect(typeof(IFlagsAttribute), "flags", flags);
     reflector.Reflect(typeof(ITypeAttribute), "type", type);
 }
Beispiel #3
0
        public override void ReflectWith(IAttributeReflector reflector)
        {
            string reading         = GetReading();
            string readingEN       = reading is null ? null : ToStringUtil.GetRomanization(reading);
            string pronunciation   = GetPronunciation();
            string pronunciationEN = pronunciation is null ? null : ToStringUtil.GetRomanization(pronunciation);

            reflector.Reflect <IReadingAttribute>("reading", reading);
            reflector.Reflect <IReadingAttribute>("reading (en)", readingEN);
            reflector.Reflect <IReadingAttribute>("pronunciation", pronunciation);
            reflector.Reflect <IReadingAttribute>("pronunciation (en)", pronunciationEN);
        }
Beispiel #4
0
        public override void ReflectWith(IAttributeReflector reflector)
        {
            string type   = GetInflectionType();
            string typeEN = type is null ? null : ToStringUtil.GetInflectionTypeTranslation(type);

            reflector.Reflect <IInflectionAttribute>("inflectionType", type);
            reflector.Reflect <IInflectionAttribute>("inflectionType (en)", typeEN);
            string form   = GetInflectionForm();
            string formEN = form is null ? null : ToStringUtil.GetInflectedFormTranslation(form);

            reflector.Reflect <IInflectionAttribute>("inflectionForm", form);
            reflector.Reflect <IInflectionAttribute>("inflectionForm (en)", formEN);
        }
Beispiel #5
0
        public virtual void ReflectWith(IAttributeReflector reflector) // LUCENENET NOTE: This method was abstract in Lucene
        {
            Type clazz = this.GetType();
            LinkedList <WeakReference> interfaces = AttributeSource.GetAttributeInterfaces(clazz);

            if (interfaces.Count != 1)
            {
                throw new NotSupportedException(clazz.Name + " implements more than one Attribute interface, the default ReflectWith() implementation cannot handle this.");
            }

            Type interf = (System.Type)interfaces.First().Target;

            /*object target = interfaces.First.Value;
             *
             * if (target == null)
             *  return;
             *
             * Type interf = target.GetType();// as Type;*/

            //problem: the interfaces list has weak references that could have expired already

            FieldInfo[] fields = clazz.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly);
            try
            {
                for (int i = 0; i < fields.Length; i++)
                {
                    FieldInfo f = fields[i];
                    if (f.IsStatic)
                    {
                        continue;
                    }
                    reflector.Reflect(interf, f.Name, f.GetValue(this));
                }
            }
            catch (MemberAccessException e)
            {
                throw new Exception(e.ToString(), e);
            }
        }
Beispiel #6
0
 public override void ReflectWith(IAttributeReflector reflector)
 {
     reflector.Reflect(typeof(ICharTermAttribute), "term", ToString());
     FillBytesRef();
     reflector.Reflect(typeof(ITermToBytesRefAttribute), "bytes", BytesRef.DeepCopyOf(Bytes));
 }
Beispiel #7
0
 public override void ReflectWith(IAttributeReflector reflector)
 {
     reflector.Reflect(typeof(BaseFormAttribute), "baseForm", GetBaseForm());
 }
 public override void ReflectWith(IAttributeReflector reflector)
 {
     reflector.Reflect(typeof(ICharTermAttribute), "term", ToString());
     FillBytesRef();
     reflector.Reflect(typeof(ITermToBytesRefAttribute), "bytes", BytesRef.DeepCopyOf(Bytes));
 }