그래서 여기에 모든 Java 전문가에게 제 질문이 있습니다. 속성 파일에서 다른 클래스로 쿼리를 가져 오는 문자열을 전달하려고합니다. 이것이 정말로 기본적인 것 같아서 미안해 ... 나는 정말로 그것을 어떻게하는지 모른다. 여기에 지금까지 여기 문자열을 다른 클래스에 쿼리로 전달
public class CrunchifyGetPropertyValues {
public String getPropValues() throws IOException {
//some code...
// get the property value and print it out
String user = prop.getProperty("user");
String startDate = prop.getProperty("startDate");
String endDate = prop.getProperty("endDate");
String values = prop.getProperty("values");
result = "stuff = " + startDate + ", " + endDate + ", " + values;
System.out.println(result + "\nProgram Ran on " + time + " by user=" + user);
return result;
}
//this is the code that i thought i needed to connect the strings
executeDataQuery startConv = new executeDataQuery();
startConv.executeDataQuery(startDate);
}
내가
private static GaData executeDataQuery(Analytics analytics, String profileId, String newValueData) throws IOException {
return analytics.data().ga().get("ga:" + profileId, // Table Id. ga: + profile id.
newValue Data, // Start date: here is where i want to import the strings into
"2014-05-20", // End date.
"ga:pageviews,ga:sessions,ga:uniquePageviews") // Metrics.
.setDimensions("ga:date")
.setSort("-ga:date")
.setMaxResults(25)
.execute();
}
편집에 문자열을 넣어하려고 내 쿼리가 가지고 무엇을 : 그래서 내가 주위에 몇 가지 물건을 변경했지만 내 코드는 갔다 여기에 새로운 오류 나 ... 난 문자열 새로운 StringValue = getPropValues ()에 넣어
try {
httpTransport = GoogleNetHttpTransport.newTrustedTransport();
dataStoreFactory = new FileDataStoreFactory(DATA_STORE_DIR);
Analytics analytics = initializeAnalytics();
String profileId = getFirstProfileId(analytics);
String newStringValue = getPropValues();
if (profileId == null) {
System.err.println("No profiles found.");
} else {
GaData gaData = executeDataQuery(analytics, profileId, newStringValue);
printGaData(gaData);
}
//lots of other code
은 ...이 방법은 ... 어떤 도움을 정의 할 수 없음을 말한다?
'System.out.println (myString);'이라고 말하면 문자열을 다른 클래스에 전달합니다. 귀하의 상황에 특별히 특별한 것은 무엇입니까? –