internal

Is there anything like an Internal class in Java?

荒凉一梦 提交于 2019-11-28 07:11:00
In C# you can mark a class as internal so that it is only accessible from within the same package. Is there anything similar in Java? You can create package-private classes by omitting the security modifier (public, private) from the class's declaration. package com.sample; class MyPackagePrivateClass { ... } Dropping the access modifier is similar to internal in C#. C# public class A { public static int X; internal static int Y; private static int Z; } internal class B { public static int X; internal static int Y; private static int Z; public class C { public static int X; internal static int

Execution flow in MVC

人盡茶涼 提交于 2019-11-28 06:31:41
I am trying to learn MVC in detail, and I am wondering what's the exact functional flow internally, in the sense of which functions (important functions) are called and what they do when the application starts and what functions are called apart from the controller actions that we write in our application as we proceed. Eilon Here are the detailed steps: Request comes into ASP.NET ASP.NET Routing finds the route match by calling RouteCollection.GetRouteData This in turn calls RouteBase.GetRouteData on each route until it finds a match The IRouteHandler for the matching route has its

Accessing internal members via System.Reflection?

℡╲_俬逩灬. 提交于 2019-11-28 05:52:06
I'm trying to Unit Test a class that has many internal functions. These obviously need testing too, but my Tests project is seperate, mainly because it covers many small, related projects. What I have so far is: FieldInfo[] _fields = typeof(ButtonedForm.TitleButton).GetFields( BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly); Console.WriteLine("{0} fields:", _fields.Length); foreach (FieldInfo fi in _fields) { Console.WriteLine(fi.Name); } This spits out all the private members nicely, but still doesn't display internals. I know this is possible, because when I was

Creating folder in internal Memory to save files and retrieve them later

↘锁芯ラ 提交于 2019-11-27 20:56:09
I want to make a folder in the Internal Memory in my application to store Audio Files,then check if the exist to do some operations. How to make this folde, in which path, and how to retrieve these files again? File mydir = context.getDir("mydir", Context.MODE_PRIVATE); //Creating an internal dir; File fileWithinMyDir = new File(mydir, "myfile"); //Getting a file within the dir. FileOutputStream out = new FileOutputStream(fileWithinMyDir); //Use the stream as usual to write into the file For deleting a file from internal : if (new File("path/to/file").delete()) { // Deleted } else { // Not

Why does python `any` return a bool instead of the value?

流过昼夜 提交于 2019-11-27 20:38:23
问题 and and or return the last element they evaluated, but why doesn't Python's built-in function any ? I mean it's pretty easy to implement oneself like this, but I'm still left wondering why. def any(l): for x in l: if x: return x return x edit: To add to the answers below, here's an actual quote from that same mailing list of ye mighty emperor on the issue: Whether to always return True and False or the first faling / passing element? I played with that too before blogging, and realized that

How to test internal class library?

别等时光非礼了梦想. 提交于 2019-11-27 18:56:09
I would like to write a class library which creates for me a complex object but should only be exposed as little as possible. I want it to be included into other projects and there I only have one call to this library which e.g. returns me an object of a internally created class. I don't want to allow others to create these objects explicitly, but still I want to create a test project for this class library. For example: var result = Manager.Instance.Create(definition) This should be the only access to the class library. Based on the definition parameter it uses different sub classes to create

Sending DTMF tones over the uplink in-call

99封情书 提交于 2019-11-27 18:23:50
I'm working on a project that requires my app to be able to send DTMF tones on the voice's uplink frequency during an active call. My 2 conditions are: We don't use a customized Android platform We don't need to root the phone I've spent several days doing my homework and am aware that in-call DTMF sending is not supported by the current SDK/standard APIs. However, by using the relevant classes in com.android.internal.telephony I am hoping to mimic how the native Phone app does this. I followed this site on how to use internal APIs for standard 3rd party apps . I've also set myself up with the

C# internal interface with internal implementation

青春壹個敷衍的年華 提交于 2019-11-27 17:06:44
问题 I've struck upon something I don't really understand. I have a project, where I have an interface that is internal. The class that implements that interface is also internal. In the implementation of the interface, I make all the members that I implement, internal. I did not do an explicit implementation. I have two interfaces and two classes that implement those interfaces where this works fine. It would look something like this: internal interface IA { void X(); } and then internal class CA

Why use a public method in an internal class?

痞子三分冷 提交于 2019-11-27 16:45:23
There is a lot of code in one of our projects that looks like this: internal static class Extensions { public static string AddFoo(this string s) { if (!string.IsNullOrEmpty(s)) return s + "Foo"; return "Foo"; } } Is there any explicit reason to do this other than "it is easier to make the type public later?" I suspect it only matters in very strange edge cases (reflection in Silverlight) or not at all. UPDATE: This question was the subject of my blog in September 2014 . Thanks for the great question! There is considerable debate on this question even within the compiler team itself. First off

How to get my Android device Internal Download Folder path [duplicate]

故事扮演 提交于 2019-11-27 07:28:33
This question already has an answer here: how to access downloads folder in android? 4 answers It is possible to get the Android device Internal Download Folder path? Dinithe Pieris if a device has an SD card, you use: Environment.getExternalStorageState() if you don't have an SD card, you use: Environment.getDataDirectory() if there is no SD card, you can create your own directory on the device locally. //if there is no SD card, create new directory objects to make directory on device if (Environment.getExternalStorageState() == null) { //create new file directory object directory = new File