예제 #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private int getField(String name) throws NoSuchFieldException, IllegalAccessException
        private int GetField(string name)
        {
            System.Reflection.FieldInfo field = typeof(Terms).getDeclaredField(name);
            field.Accessible = true;
            long[] longs = ( long[] )field.get(_terms);
            return(longs.Length);
        }
예제 #2
0
        /// <summary>
        /// Obtain the 'valueTypes' of the ObjectTypeAttributeDefinition through reflection because they are private in Wildfly 8.
        /// </summary>
        public static AttributeDefinition[] getValueTypes(object instance, Type clazz)
        {
            try
            {
                if (clazz.IsAssignableFrom(typeof(ObjectTypeAttributeDefinition)))
                {
                    System.Reflection.FieldInfo valueTypesField = clazz.getDeclaredField("valueTypes");
                    valueTypesField.Accessible = true;
                    object value = valueTypesField.get(instance);
                    if (value != null)
                    {
                        if (value.GetType().IsAssignableFrom(typeof(AttributeDefinition[])))
                        {
                            return((AttributeDefinition[])value);
                        }
                    }
                    return((AttributeDefinition[])value);
                }
            }
            catch (Exception e)
            {
                throw new Exception("Unable to get valueTypes.", e);
            }

            return(null);
        }
예제 #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static org.neo4j.kernel.api.KernelTransaction kernelTransaction(org.neo4j.graphdb.Transaction tx) throws Exception
        public static KernelTransaction KernelTransaction(Transaction tx)
        {
            assertThat(tx, instanceOf(typeof(TopLevelTransaction)));
            System.Reflection.FieldInfo transactionField = typeof(TopLevelTransaction).getDeclaredField("transaction");
            transactionField.Accessible = true;
            return(( KernelTransaction )transactionField.get(tx));
        }